pwd

Introduction

In the Linux hierarchy, users can use the mkdir command to create a new directory in any authorized directory, or use the cd command to switch from one directory to another. However, there is no prompt to tell the user which directory the user is currently in. To know the current directory, you can use the pwd command, which displays the entire path name.

Full name

PrintWorkingDirectory

Purpose

Display the path name of the working directory.

Syntax

pwd[-L|-P]

pwd

Description

The pwd command changes the full path name of the current directory (from the root Directory) write to standard output. All directories are separated by / (slash). The first / represents the root directory, and the last directory is the current directory.

Flag

-L

If the PWD environment variable contains the absolute path of the current directory that does not contain the file name. (dot) or .. (dot) Name, the value of the PWD environment variable is displayed. Otherwise, the -L flag operates the same as the -P flag.

-P

Display the absolute path name of the current directory. The absolute path displayed with the -P flag is not included in the absolute path of the path name involving the file name of the symbolic link type.

Exit status

The command returns the following exit value:

0 completed successfully.

0 An error occurred.

Related Articles
TOP