Linux pwd Command Tutorial

Linux and Unix operating systems provide the pwd command which prints the full pathname of the current working directory. The pwd name comes from print working directory . As a simple command is provided few options. the pwd command is provided as a shell built-in command for most of the shells like Bourne shell, bash, ash, ksh, zsh etc.

Print Current Working Directory

The current working directory can be printed with the pwd command without any option. As stated previously the pwd command the full path of the current working directory. But if there is a symlink during directory change the symlink is printed

$ pwd

Display pwd Command Options

The --help option can be used to display pwd command options. This lists the option and a brief explanation about the command.

$ pwd --help
Display pwd Command Options

Print Current Working Directory Avoiding Symlinks

By default the pwd command prints the current working directory with symlinks. But we can prevent the symlinks and print real directories with the -P option like below.

$ pwd -P

Leave a Comment