How to Change the Current Working Directory using the Terminal on Linux Mint

Share
In this tutorial, we'll learn how to change the current working directory in the terminal on Linux Mint. This is useful and often necessary because the behavior of many terminal commands on its current value.

To change the current working directory, we use the command cd. For example, if you execute the following terminal command [how?], the current working directory will be changed to /etc:

cd /etc

Doing this changes the $PWD environment variable, and consequently the output of the pwd command and your shell prompt, if it uses pwd. By default, the current working directory on Linux Mint is your home directory, represented by a tilde (~). Observe what should happen when we use cd: (the text code before $ is the shell prompt)

john@pc:~$ cd /etc
john@pc:/etc$ 

You can use .. to jump to the parent directory. As usual, filenames are resolved relative to the current working directory, which means cd bin from /usr will cd into /usr/bin.

~$ cd /etc
/etc$ cd ..
/$ cd usr
/usr$ cd bin
/usr/bin$ cd ../../lib
/lib$ cd /home/john
~$
A terminal window showing the command "cd" being used: on ~, cd Pictures/, then on ~/Pictures, cd ../Documents/, then on ~/Documents, cd .., then back on ~ again.
What happens when you use the cd terminal command on Linux Mint.
Written by Noel Santos.

About the Author

I'm a self-taught Brazilian programmer graduated in IT from a FATEC. In a world of increasingly complex and essential computers, I decided to use my technical expertise in hardware, desktop applications, and web technologies to create an informative resource to make PC's easier to understand.

View Comments