How to make use of cd command in terminal

5

In lately’s running programs, there are two tactics to have interaction with the purposes of an OS; one is Graphical User Interface, and the second one is the command line. GUI is straightforward to grasp and user-friendly; on the other hand, the command line is fascinating to avoid wasting time, do the duties differently (rather then GUI). For this, Ubuntu has an extended listing of instructions which are to be had to do the specified task the usage of terminal: similar to cd (exchange listing) command permits the customers to modify the present listing to another listing and is appropriate to nearly all Linux distros. You can navigate to directories which are provide within the present listing, however you will have to give your complete trail or a step by step transfer to modify the present listing to a listing rather then directories found in pwd. In this descriptive publish, we will be able to supply a information to exhibit the usage of the cd command in Ubuntu.

So, prior to digging into main points, let’s take a look on the syntax of the command:

cd [options] [directory_path or directory_name]

How to make use of the cd command in Ubuntu

The syntax of the cd command is straightforward to grasp and practice within the terminal: this phase will supply an in depth information to make use of the cd command in Ubuntu.

As the cd command is focused on directories; so, we will have to know the present listing. Type the command said beneath to test the existing operating listing

As you’ll be able to see, the existing operating listing is “/house/adnan“.

How to modify the present listing to root listing the usage of the cd command

It does no longer topic during which listing you might be; if you wish to transfer the terminal to the foundation listing, you will have to put “/” after the “cd” key phrase. For example, we’re within the “Desktop” listing and need to cross to the foundation listing, execute the command as given beneath:

How to modify the present listing to house listing the usage of the cd command

If you need to transport the existing operating listing to the house listing, use the next image “~” (referred to as the tilde) with the “cd” key phrase. Let’s say we’re within the “Pictures” listing; use the next command to get again to the house listing:

How to modify the present listing to father or mother listing the usage of the cd command

You can transfer to the father or mother listing of the pwd by way of executing the next command. For example, we’re recently in our “Downloads” listing and need to return to the father or mother listing:

How to navigate to the sub-directory of a present listing the usage of the cd command

Firstly, we will be able to test the listing of sub-directories. So, to get the listing of sub-directories found in “/home/adnan”; execute the next command:

Let’s say we need to direct the terminal to the “Desktop” listing; you’ll be able to achieve this by way of executing the next command as given beneath:

You can function the terminal from any listing within your drives; it’s simple to make use of the “cd” command to transport to at least one or two sub-directories, however what if we need to get right of entry to a listing this is 4 to five directories clear of our provide operating listing; it’s conceivable to make use of “cd” as now we have finished above to get right of entry to “Desktop“; on the other hand, it’s more straightforward to get right of entry to the listing by way of giving the trail to the “cd“:

Syntax: cd [path of the directory]

The syntax of the command given beneath will assist to get right of entry to the “final_dir” which is found in subdirectories of the “Desktop” listing.

$ cd /house/adnan/Desktop/dir1/dir2/dir3/final_dir

If you need to navigate to a listing that accommodates clean areas, you will have to insert the listing title within unmarried or double-quotes. Otherwise, you gained’t be capable of get to that listing:

Syntax: cd [“name of directory”]

For instance, there’s a listing named “test dir” in our house listing; so, execute the next command to get to that:

Or the listing (with white areas) will also be accessed the usage of the next command:

Conclusion

Directory dealing with is probably the most used and necessary characteristic of any running machine; you’ll be able to transfer the directories the usage of GUI and CLI. The Ubuntu command line terminal additionally helps instructions to accomplish any motion; each time you open your Ubuntu terminal, it’s going to open within the default(house) listing, and you’ll be able to use the cd command to get right of entry to different directories the usage of the terminal. This article is all concerning the cd command of Ubuntu; now we have in brief mentioned the usage of the cd command; this command may also be completed in the entire Linux distributions. You can exchange directories with the assistance of the cd command and will use its in depth fortify of to be had choices to get filtered effects.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More