In this article, we will show you how to determine your current working directory using the
What is the Current Working Directory
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
For example, to change the current working directory to
/tmp you would type:
If you have a customized
zsh prompt, the path to the current working directory may be shown in the shell prompt.
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 command to display all locations containing
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
How to Find your Current Working Directory
To find out what directory you are currently in, type
pwd in your terminal:
The output will look something like this:
pwd does is printing the
PWD environment variable.
You will get the same output if you type:
pwd command can accept only two arguments:
--logical) - Do not resolve symlinks.
--physical) - Display the physical directory, without any symbolic links.
By default, id no option is used,
pwd behaves as if
-L option is specified.
Now if you navigate to the
/tmp/symlink directory and you type
pwd in your terminal:
The output will show that your current working directory is
If you run the same command using the
The command will print the directory to which the symlink points to:
The current working directory is the directory from which you invoke commands in your terminal.
pwd command is used to display the current working directory.
If you have any questions or feedback, feel free to leave a comment.