common used options for cd command in linux

AbdelRahman metwally - Oct 30 - - Dev Community

It is the first time for me to write a post in a technical platform , but i would like to participate and write something that may help some of learners or even the people that have an experience in linux but may did not know some of these options.

One of the reasons to start writing this series of small posts, is that i found some people that have an experience in linux even more than me, but do not use some easy and good options that may help them to enhance there way of work and reduce their effort.

So i decided to start writing this series, hoping that it may help some of who using linux.

First , starting with one of the most common linux used command "cd" change directory.

  • It is used to change you current directory to another one, while moving in the filesystem, and it has many options like:

  • cd .. : change to the parent directory

  • cd . : will stay in the current directory

  • cd / : change to the root directory

  • cd ../..: will back to the parent of the current parent directory.

  • cd $HOME=cd=cd ~: will move you to the home directory

    NOTE: if you changed the $HOME environment variable then all commands in the provious "cd" option will go the new path.

  • cd - : will take you to the previous path.

  • cd 'dir name': use '' if the dir name contains space.

  • cd [absolute_path] : will go to that path.

  • cd ./[relative_path]=cd [relative_path]: will move you to this path

  • cd !$:Changes to the last argument of the previous command.

I welcome any discussions or comments about this post. You may also find the examples in this link helpful.

.
Terabox Video Player