pwd Command Examples in Linux

In Linux and other Unix-like operating systems, the pwd command stands for “print working directory.” It is a command-line utility that allows you to display the full path of the current working directory.

To use the pwd command, simply type pwd at the command prompt and press Enter. The command will output the full path of the current working directory, for example:

$ pwd
/home/user/documents

You can also use the pwd command with certain options to modify its behavior. For example, the -L option causes the pwd command to follow symbolic links and print the actual path of the link, rather than the path of the link’s target. The -P option, on the other hand, causes the pwd command to print the physical directory structure, rather than following symbolic links.

pwd Command Examples

1. To get the current working directory:

# pwd 

2. To get the present working directory from environment:

# pwd -L
# pwd --logical 

3. To avoid all symlinks:

# pwd -P
# pwd --physical 

4. To get the pwd help:

# pwd --help

5. To get the pwd version info:

# pwd --version 
Related Post