...

/

Command cd

Command cd

Learn about the `cd` command in detail.

The cd command

Now that we have got everything about the current directory, we can change it.

Let’s suppose that we want to go to a directory named usr. We will call the cd command to go to the /usr path. We can do it this way:

cd /usr

Let’s connect to the following terminal and run the above command.

Changing directories
Terminal 1
Terminal
Loading...

Autocompletion works for both command and its parameters. Let’s try it in the terminal above this way:

  1. Type cd /us text.
  2. Press the “Tab” key twice.
  3. Bash displays the directories that start with /us.
  4. Complete our command by typing r or e, and then press the “Tab” key once.

The following figure shows the result of these commands:

The cd ...