Linux pwd command tutorial

The pwd command is used quite often in the Unix command line environment where the shell doesn't show the name of the working directory. Type 'pwd' in the command line will print the name of current/working directory. In Linux, where bash is the default shell, we can always see what directory we are in. The name of the current directory is shown at the command prompt after the host name. See the example below:

[email protected]:~$

The '~' shows our current directory is the user's home directory. We can confirm that with the Linux pwd command:

[email protected]:~$ pwd

Now let's change to another directory:

[email protected]:~$
[email protected]:~$ cd /home/ftp
[email protected]:/home/ftp$

When we change the directory to /home/ftp directory, the '~' has changed to our current directory. If we check again with Linux pwd command, we would get the result as in the example below:

[email protected]:~$ pwd

The Linux pwd command doesn't have any other option except for '-LP' which will print the same result as example above. If you open the pwd manual page, there are no '-L' or '-P' options. The supplied options '--help' and '--version' options would give you 'invalid option' when used with pwd command in Ubuntu desktop such as in the example below:

[email protected]:~$ pwd --help
bash: pwd: --: invalid option
pwd: usage: pwd [-LP]

That's all.

Back to Other important Linux basic commands main page.

Add new comment