1. Home
  2. Directory Operations
  3. pwd Command Examples and Usage

pwd Command Examples and Usage

pwd command is for printing the current working directory. It will print the full system path of the current working directory to standard output. By default the pwd command ignores symlinks, although the full physical path of a current directory can be shown with an option. The manual and pwd command examples are what you need to learn as Linux command line.

NAME

pwd – print name of current/working directory

pwd Command Examples - Enlinux
pwd Command Examples – Enlinux

SYNOPSIS

pwd [OPTION]…

DESCRIPTION

Print the full filename of the current working directory.

-L, --logical

Use PWD from environment, even if it contains symlinks.

-P, --physical

Avoid all symlinks.

--help display this help and exit
--version output version information and exit

If no option is specified, -P is assumed.

NOTE: your shell may have its own version of pwd, which usually supersedes the version described here. Please refer to your shell’s documentation for details about the options it supports.

nix/Linux pwd command.

pwd – print working directory, is a Linux command to get the current working directory.

pwd Command Examples

Change directory to /usr/src directory and print working directory:

$ cd /usr/src
$ pwd
/user/src

Change directory to home directory and print working directory:

$ cd ~
$ pwd
/home/user

Change directory to parent directory of the home directory and print working directory:

$ cd ~/..
$ pwd
/home

Change directory to root directory and print working directory:

$ cd /
$ pwd
/

Read more about Linux Command Line.

Updated on September 8, 2021

Was this article helpful?

Related Articles

Leave a Comment