The cd
(change directory) command in Linux is used to change the current working directory.
The syntax of cd command is as follows:
cd [OPTION]... [DIRECTORY]
Where OPTION
can be
-L
(follow symbolic links as if they were directories)-P
(do not follow symbolic links, instead resolve them to the final target of the link), or--
(end the options and start processing the arguments)
and DIRECTORY
is the name of the directory you want to change to. If no directory is specified, the cd
command will change the current working directory to the user’s home directory.
Examples:
cd /home/myuser/mydocs
Above command changes to the /home/myuser/mydocs directory on your machine.
cd ..
Above command changes to the parent directory ( i.e. one directory above from where you are right now )
cd #
Above command changes to the current users home directory.