Console logo


cd may be one of the most used Linux commands. From Wikipedia:

cd, sometimes also available as chdir (change directory), is a command line command to change the current working directory in operating systems such as Unix, DOS, OS/2, AmigaOS (where if a bare path is given, cd is implied), Windows, and Linux. It is also available for use in shell scripts and batch files.

There are some few tips that can help you save some time, while navigating between your folders in Linux. This article will touch a few of them, if you know more, please share in the comments.

Change directory cd command tips for Linux

Return to home

I wish in real life could be that easy to go back home as it is in Linux, and maybe baseball players may wish the same in the diamond field.

Well, to go back home, no matter where in the directory tree you might be just enter at the command prompt:


That's it, with no parameters, you will be taken home.

One level below

If you want to go back just one level, enter at the Linux command prompt:

cd ..

There is a space between cd and .. (the two points).

Two levels below

If you want to go back two levels, enter:

cd ../..

Now you have the idea, and for sure you know how to go back three, four, five... and more levels below the current directory.

To a folder in a parallel level

If you want to go to a folder in the parallel level, where you actually are, you do not need to go down and then up again, you can do it in just one step.

Let's see this example, suppose you are:


Now, if you enter:

cd ../samba/

You will be at:


Jump between folders

If you want to jump between folders, just like you jump between T.V. Channels with the remote control, with the "recall" or "jump" key, use:

cd -

Note the space between cd and the dash -

This way you can go back and forth, between two directories, this is very useful when are working on two folders at the same time. I use it a lot, when editing a shell script in my home directory, and testing the script in /tmp/ folder.