Categories
Linux Tutorial Series

Linux Tutorial Series – 28 – The cd command

Here is the video version, if you prefer it:

The cd command is used to change the working directory. Its name, cd, literally stands for “change directory”.(“cd(1) – Linux man page,” n.d.)⁠

For example, if I wanted to go to folder named Downloads relative to my current directory, I would write:

mislav@mislavovo-racunalo:~$ cd Downloads

However, let’s say I was somewhere far, far away from my Downloads folder. Let’s say I was in somewhere like /usr/local/bin. Pretty tough to navigate from here to my Downloads folder (not impossible, but tedious – I would have to write cd .. to go to the parent folder, then repeat that multiple times until I reached the root folder, then cd myself into home and then mislav and then finally Downloads). Here I would use:

mislav@mislavovo-racunalo:/usr/local/bin$ cd /home/mislav/Downloads

and I would get to my desired Downloads folder without a lot of navigation.

To emphasize: You can always use cd .. to go to the parent folder of the current directory and then use cd someFolder to position yourself in the folder someFolder.

Hope this was helpful!

P.S. To be honest with you, I usually change directories the tedious way, as in writing cd .. and cd SomeFolder a lot of times, but I believe that it is much easier to get the work done with providing an absolute pathname. So this is some “I advise doing this even if I do this the other way” type of advice.

References

cd(1) – Linux man page. (n.d.). Retrieved January 5, 2020, from https://linux.die.net/man/1/cd