Command cd stands for Change Directory.
You can change directory or move from one directory to another directory by using cd command.
Syntax:
1 | $ cd [directory name] [press enter] |
Example:
pwd command display the absolute path name of current directory. To see the current directory absolute path press pwd command on terminal.
1 2 | $ pwd [press enter] /home/it |
We are currently in “ it ’ directory which resides in home directory.
Suppose we want to move to directory “abc” . Note directory “abc” must be in the current directory. The command to move in the current directory shown below
1 | $ cd abc [press enter] |
Now we are inside the directory “abc”. To confirm press command “pwd”.
1 2 | $ pwd [press enter] /home/it/abc |
Back To Home Directory: Suppose now we are inside sub-sub directory and willing to go back to the home directory the simply press command cd.
1 2 3 4 5 | $ pwd [press enter] /home/it/abc/xyz $ cd [press enter] $ pwd [press enter] /home/it |
Change Directory With Absolute Path Name: Suppose we want to move in the random directory which is not present in the current directory then absolute pathname must be specified with “cd” command.
1 2 3 4 5 | $ pwd [press enter] /home/it $ cd /abc/xyz [press enter] $ pwd [press enter] /home/it/abc/xyz |