Change/Print Current Working Directory

Change the Directory

cd command is used to move into another directory and make it the current working directory.


cd [directory]

For example, to change the current directory from animals to birds, you would type:

cd birds

animals directory should be one level up of birds directory (animals is the parent of birds).

To change current directory to root, home, parent directories, refer the below point_down table.




cd /

parent(one level up)

cd ..


cd ~ or cd


  • To change directory from /usr to /usr/local/share directory, you would type:

cd local/share
  • Suppose that you want to go to the Downloads directory from your current directory, and you know that the Downloads directory resides in the home directory, you type:

cd ~/Downloads
  • For Example, you are in the /usr/local/share directory, and you want to switch to the /usr/local/src. You can do that by typing:

cd ../src

Print Current Directory

The current working directory is the directory where all the commands are being executed. To know your current directory, you can use the pwd command which stands for Print Working Directory.



This will print the absolute path of the current directory as follows:


The name of the current working directory is the last directory in the absolute path. For example, in the above example, dir2 is the current working directory.