Clyde E. Boom asked: Overview of The Linux pwd Command The Linux
pwd command name stands for path to working directory,which is the directory that you’re currently working “in”.
The Linux command prompt for some Linux distributions shows the current name of the directory that you are currently in – but some don’t.
Also, by default the command line prompt for some Linux distributions doesn’t show the full path to your current directory.
This is where the Linux pwd command comes in handy. Any time you need to see the name of your active directory, as well as the full directory path to it, you just type in pwd (in lower case letters) and press Enter.
Examples of Using the Linux pwd Command To See Your Full Directory PathBelow are examples of using pwd command see your current and full directory path.
Use the cd command to change into the /usr/share/man directory path.
$ cd /usr/share/man
Now type in pwd and press Enter to see your full path and your current directory will appear at the right of the output of the command.
You can use the ~ (tilde) with the cd command to change into the home directory of your current user.
On most Linux distributions, each user has a username and that username is used as the name of the “home” directory of the user.
The home directories for Linux users are typically located below the path of /home.
If there are 23 Linux users on a system, then there will be 23 directories below /home.
Now use the ~ (tilde) to change into your home directory (as shown below) and then run the pwd command again to see the full path to your home directory. Is it below the path of /home?
$ cd ~
For your Linux distribution, your command prompt may not show the full path to your home directory, just the ~ symbol to represent the home directory.
Now change into the path of /home (as shown below) and then list the directories below your current directory (path).
$ cd /home
$ ls -l
How many Linux users are there “set up” on your system?
Now run “cd ~” again to change back to your home directory and then run the command to see your current full path.
The Linux concepts and commands here apply to ALL Linux distributions, including Ubuntu, SUSE, Red Hat, Fedora, openSUSE, Debian and Slackware Linux.
Caffeinated Content