So, just before digging into information, let’s have a glance at the syntax of the command:
cd [options] [directory_path or directory_name]
How to use the cd command in Ubuntu
The syntax of the cd command is quick to understand and use in the terminal: this portion will offer a thorough information to use the cd command in Ubuntu.
As the cd command is involved with directories so, we need to know the present listing. Sort the command stated under to examine the present working directory
As you can see, the present doing work directory is “/residence/adnan“.
How to transform the present-day directory to root directory utilizing the cd command
It does not make a difference in which directory you are if you want to move the terminal to the root directory, you have to set “/” following the “cd” search phrase. For occasion, we are in the “Desktop” directory and want to go to the root listing, execute the command as given underneath:
How to modify the present-day directory to house directory working with the cd command
If you want to transfer the existing working listing to the residence directory, use the subsequent image “~” (known as the tilde) with the “cd” keyword. Let’s say we are in the “Photographs” directory use the next command to get again to the household listing:
How to modify the latest listing to mother or father listing utilizing the cd command
You can shift to the mum or dad listing of the pwd by executing the adhering to command. For occasion, we are currently in our “Downloads” listing and want to go back to the guardian directory:
How to navigate to the sub-directory of a present-day listing using the cd command
To start with, we will look at the list of sub-directories. So, to get the list of sub-directories existing in “/dwelling/adnan” execute the next command:
Let’s say we want to direct the terminal to the “Desktop” directory you can do so by executing the subsequent command as specified underneath:
You can run the terminal from any directory within your drives it is simple to use the “cd” command to go to a single or two sub-directories, but what if we want to entry a directory that is 4 to 5 directories away from our present doing work directory it is probable to use “cd” as we have finished above to obtain “Desktop“ having said that, it is much easier to access the listing by offering the route to the “cd“:
Syntax: cd [path of the directory]
The syntax of the command specified underneath will aid to obtain the “closing_dir” which is present in subdirectories of the “Desktop” directory.
$ cd /dwelling/adnan/Desktop/dir1/dir2/dir3/last_dir
If you want to navigate to a directory that consists of blank spaces, you will have to insert the directory name inside of single or double-prices. If not, you won’t be able to get to that directory:
Syntax: cd [“name of directory”]
For illustration, there is a directory named “exam dir” in our dwelling directory so, execute the pursuing command to get to that:
Or the listing (with white spaces) can also be accessed employing the subsequent command:
Directory managing is the most used and vital function of any working procedure you can change the directories making use of GUI and CLI. The Ubuntu command line terminal also supports instructions to perform any action any time you open your Ubuntu terminal, it will open up in the default(residence) listing, and you can use the cd command to access other directories using the terminal. This short article is all about the cd command of Ubuntu we have briefly reviewed the use of the cd command this command can be executed in all the Linux distributions. You can alter directories with the support of the cd command and can use its substantial help of offered selections to get filtered effects.