How to get current working directory

Unix/Linux get current working directory.

To get the current working directory use the pwd command.

For example if we change the directory to /home/user, pwd will print /home/user as the current working directory:

$ cd /home/user
$ pwd
/home/user

 

In Bash shell script you can get the current working directory by:

dir=$(PWD)

 

pwd command ►

 


Advertising

LINUX
°• CmtoInchesConvert.com •°