How do I cd into a directory in the home folder?

cd ~/Downloads

Remember: Linux is case sensitive, so Downloads and downloads are different directories.

~ is a "shortcut" to the home directory. Another one would be $HOME. If you're already in your home directory you can just cd Downloads.


From the Downloads directory, you can quickly return to your home directory by simply typing cd at the prompt. cd ~ does the same thing.

There two basic ways to get around in BASH:

  1. Using absolute pathnames
  2. Using relative pathnames

Absolute pathnames start at the root directory, denoted by a leading /, and can be used from anywhere. To use the absolute path to go to Downloads, you can run:

cd /home/<username>/Downloads

where <username> is replaced with your username. You can also replace it with the environment variable $USER which usually expands to the username of the user currently running the shell. You can also replace /home/<username> with $HOME, which will usually expand to the absolute path of the home directory of the user running the shell.

A useful shortcut for this is

cd ~/Downloads

The tilde character (~) takes the place of /home/<username> - it expands to the home directory of the user currently running the shell. Note that this expansion will not be performed if the tilde character is in double or single quotes.

Relative pathnames start at the working directory (the one you're in). So if you know what directory you're in, you can use some shortcuts to get around. For example

  • . (dot) refers to the current working directory
  • .. (dot)(dot) refers to the parents directory of the current working directory

when you are in your Home folder and type cd Downloads you could also type ./Downloads The ./ is implied when you just type cd Downloads (working directory is implied if you don't include a pathname).

When you are in the Downloads directory, you could also use cd .. to return to the parent directory /home/<username>. In this case it is easiest to just type cd, because that changes the working directory your home directory immediately wherever you are. However, the .. becomes very useful when you are navigating around nested directory structures or other locations on the system.