In this article, we will introduce you to these various uses of the cd command in Linux and become familiar with its most common usages. Syntax: Before continuing, you should get a basic understanding of the absolute vs relative paths in Linux.
Absolute Path is the full path of directory and always starts with / in Linux system. For example: /tmp, /usr/bin, /var/www etc. Relative Path is the partial path of any directory or subdirectory. It can be started from any location of the file path except /. For example: www, ./script.sh, ../../www etc.
Now you must memorize these symbols and special characters and use the cd command. What’s the symbol’s meaning when used with the cd command?
Single dot (.) : current directory (present directory). Double dot (..) : parent directory. Tiled (~) sign : home directory of current users. $HOME variable: home directory of current users.
cd Command Examples
Here are more examples to use with cd commands on the Linux system.
Conclsion
Change directory is the most used command in Linux systems. In this tutorial, we have described the cd command on a Linux system. We can also use multiple .. (as much as required) to navigate to any directory structure.