Linux cd command with examples

In this article, we will see Linux cd command with examples.

The cd command is one of the most frequently used commands in Linux. The cd command in linux known as change directory command. It is used to change current working directory.

Syntax:

cd Directory_name

1. How to change present working directory using cd command.

cd linux/

Linux cd command with examples

2. Switch to home directory using cd command.

cd ~

3. How to change to previous working directory in Linux. We can do this using cd –

4. How to go to root directory in Linux. cd /: this command is used to change directory to the root directory, The root directory is the first directory in your file system hierarchy.

cd /

5. How to move to parent directory
cd .. : this command is used to move to the parent directory of current directory, or the directory one level up from the current directory. “..” represents parent directory.

cd ..

To move up two parents directories use cd ../..