You are currently viewing Linux Commands – cd

Linux Commands – cd

Linux Commands – cd

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed ls command in Linux which is used for listing files and directories in Linux.

In this blog post, we will discuss cd command in Linux. cd stands for change directory and is used to change the current working directly. You can use cd command to navigate in Linux filesystem.

Linux Commands – cd:

You can use cd /some/dir to navigate to the target directory. The path provided to the cd command can be absolute (full path) or relative path.

You can use cd – to return to previous working directory and cd — to return to the directory from where cd – was last executed.

cd command without any option and argument sets the user’s home directory as current working directory.

cd . represents the current working directory and cd .. represents parent directory of the current working directory. You can navigate two or more step up to parent directory using cd ../..

cd supports two option parameters -L and -P. cd -L forces symbolic links to be followed, this is the default behavior of cd. cd -P use the physical directory structure without following symbolic links.

cd command returns 0 if executed successfully and 1 if failed to execute.

Hope you have enjoyed this article. In the next blog post, we will discuss mkdir command in Linux.


Leave a Reply