In this article, we will show you how to determine your current working directory using the pwd
command.
The current working directory is the directory in which the user is currently working in. Each time you interact with your command prompt, you are working within a directory.
By default, when you log into your Linux system, your current working directory is set to your home directory. To change the working directory use the [cd](https://linuxize.com/post/linux-cd-command/)
command.
For example, to change the current working directory to /tmp
you would type:
cd /tmp
If you have a customized bash
or zsh
prompt, the path to the current working directory may be shown in the shell prompt.
user@host:/tmp#
The pwd
command stands for print working directory. It is one of the most basic and frequently used commands in Linux. When invoked the command prints the complete path of the current working directory.
pwd
is a shell builtin in most modern shells such as bash and zsh. Its behavior is slightly different than the standalone /bin/pwd
executable. You can use the [type](https://linuxize.com/post/linux-type-command/)
command to display all locations containing pwd
:
type -a pwd
pwd is a shell builtin
pwd is /bin/pwd
As you can see from the output below, the shell builtin has priority over the standalone executable and it is used whenever you type pwd
. If you want to use the standalone pwd binary type the full path to the file /bin/pwd
#linux