Linux cd command

Linux cd is used change current directory to new location. cd stands for cahnge directory. We can say it is for navigation command.


cd [-L|-P] [dir]


-L –>Force symbolic links to be followed
-P –>Use the physical directory structure without following symbolic links


cd /: To go to top level directory(parent directory for all directories).
cd ~: To go to current user home directory
cd ..:To go one level back.
cd ../.. :
To go two levels back.
cd k2schools/file1: To go from current directory(k2schools/file1)
cd –: To go to previous working directory.
cd ../../..: To go three levels back.

Note: The trailing slash(/) is optional when we are using the cd command. It indicates that the name being specified is a directory.

Powered by k2schools
Skip to toolbar