Ubuntu – How to navigate between directories in terminal

command linedirectory

I am new to Linux and Ubuntu and have tried changing to folders/directories with some difficulty.

Could someone explain why the following commands failed to change to the desired target folder/directory?

sharon@sharon:~$ cd Home 
bash: cd: Home: No such file or directory 
sharon@sharon:~$ cd /Home 
bash: cd: /Home: No such file or directory 
sharon@sharon:~$ cd Documents 
sharon@sharon:~/Documents$ cd Downloads 
bash: cd: Downloads: No such file or directory 
sharon@sharon:~/Documents$ cd /Downloads 
bash: cd: /Downloads: No such file or directory 

Best Answer

The filesystem is GNU/Linux is like a tree, except that the root is on top. :-) So you have structure like:


If you want to move inside the tree, one option is to use relative paths. If you are in /home/sharon, then typing cd Downloads will work, because Downloads is an immediate child of your current directory. If you are in the subfolder Documents and want to change directory (cd) to Downloads, you have to go up (..) and then to Downloads. So the correct command would be cd ../Downloads.

You could also enter an absolute path. So the Downloads folder is a subfolder of sharon which is a subfolder of home which is … (you get the idea :-)) So you can also enter cd /home/sharon/Downloads wherever you are in the filesystem.

  • ~ always refers to the home directory of the current user (/home/sharon in your case). If you enter cd ~/Downloads you'll land in your Downloads folder.

  • . refers to the current directory, so cd ./Downloads is roughly equivalent to cd Downloads.

  • .. means "parent directory".

  • / at the beginning of file path refers to the root directory.

The next nice thing is tab expansion. If you enter cd ~/DowTab (last is pressing Tabulator key), the bash automatically expands it to cd ~/Downloads.

As the others said GNU/Linux is case sensitive. So it makes a difference if you enter Home, hOme or home. Furthermore I hope that you see now that there is a difference between /home and home. The first is adressed absolute while the last is relative to your current directory.

Related Question