Terminal doesn't go to /home/username/downloads

12,557

The core of this question: Directory names are case sensitive. Type cd /home/username/Downloads instead of lowercase.

Additional information

Finding out directory names: You can use ls to list files and directories in any directory , to see their names. For instance, on a fresh install, you most likely would find the following directories

$ ls /home/newuser
Desktop/    Downloads/        Music/     Public/     Videos/
Documents/  examples.desktop  Pictures/  Templates/

See how they are all capitalized? This is not the case with most of system directories, such as /etc or /bin. Traditionally, Unix/Linux commands and directories are all lower-case, though it's not a rule set in stone.

And by the way, there is dir, same as in Windows' cmd, a command which performs the same action - listing files in your current working directory.

There is an alternative: many file managers support an Open Terminal Here or Open in Terminal option. Nautilus, the default file manager for Ubuntu, does not have this feature by default as of 14.04 LTS, however there is a plugin you can install to enable this feature or use some work arounds. Refer to this question and answers to it for more information on opening a terminal from the file manager.

Navigating in Terminal

In order to navigate around your home directory, there are two "shortcuts", one is cd $HOME/Downloads and second is cd ~/Downloads.

In the first case, $HOME is an environment variable. If you run env | sort or set | sort you will see a long list of values sorted alphabetically, among which you will see a line HOME=/home/yourusername. When you run cd $HOME/Downloads the shell automatically expands $HOME to mean /home/yourusername and adds it to whatever else comes after $HOME.

For the second case, ~ also automatically gets substituted with the path to your home directory. There is a historical reason for this particular character to represent the home directory

There are also a few tricks with cd command to make navigation even easier. cd - works kind of like a go back button in a browser; if you are in one directory but want to return from where you came and do not want to type full path, just enter cd -. For instance, if I jumped from /home/Serg to /etc, I can go back to my home folder by using that cd - command.

cd .. will let you go up one directory. For example cd .. from /home/Serg will bring me up to /home.

And what if you want to jump from anywhere back to your home directory ? Just run cd by itself.

Hitting TAB will give you some suggestions on where to navigate, kind of works like auto-completion.

Occasionally you may want to enter a hidden directory with your settings, which will be initialized with a single dot, e.g. .config in your home directory. You might want to list them with ls -a. Of course you will need to type it exactly as it is listed , cd .config

And what if a directory has space or special characters in it? Again, use TAB button, or type everything by yourself, prepending spaces with backslash, e.g. cd Folder\ With\ Spaces\ In\ Name

Suggestion: Invest in a book with basic information on linux or shell programming. In my case, I found very helpful Ubuntu Linux Toolbox and Unix Shells by Example. The power of Linux lies exactly in command line.

And the most important tip - have fun with it all, love what you do!

Share:
12,557

Related videos on Youtube

Berkay Buğra Saygi
Author by

Berkay Buğra Saygi

Updated on September 18, 2022

Comments

  • Berkay Buğra Saygi
    Berkay Buğra Saygi over 1 year

    When I type cd /home, terminal goes there but when I type cd /home/myusername/downloads (or any address) terminal doesn't go there. It says no such file or directory.

    Can somebody tell me what causes this?

    • Brian Sizemore
      Brian Sizemore about 9 years
      Can you give more information? Possibly some screenshots? If you just do cd /home/yourusername does it work?
    • Berkay Buğra Saygi
      Berkay Buğra Saygi about 9 years
      Yes it works if I only type that.
    • Brian Sizemore
      Brian Sizemore about 9 years
      if you type cd /home/yourusername and then press <tab> a couple of times, it should show you your possible options
    • Berkay Buğra Saygi
      Berkay Buğra Saygi about 9 years
      I've just tried it, it shows desktop or other options but when i type i still get same error
    • Berkay Buğra Saygi
      Berkay Buğra Saygi about 9 years
      It goes with things like /.local or /.mozilla but it doesn't go with folders
    • Admin
      Admin about 9 years
      Capitalization is important. /home/username/downloads shouldn't work (unless you created the directory). /home/username/Downloads should work (unless you deleted/renamed the directory)
    • Admin
      Admin about 9 years
      Capitalization is important. /home/username/downloads shouldn't work (unless you created the directory). /home/username/Downloads should work (unless you deleted/renamed the directory). Also use ls to view the contents of the directory you're currently in (unless you do ls /path/to/other/directory).
    • s3lph
      s3lph about 9 years
      There's a nice game by the MIT for UNIX shell practice: web.mit.edu/mprat/Public/web/Terminus/Web/main.html
  • chili555
    chili555 about 9 years
    or type: ~/Downloads
  • Sergiy Kolodyazhnyy
    Sergiy Kolodyazhnyy about 9 years
    No problem. Dont forget to accept the answer. Chili, yup, that's simpler =) also $HOME/Downloads
  • Berkay Buğra Saygi
    Berkay Buğra Saygi about 9 years
    I installed ubuntu couple of hours ago for the very first time, I'm new this terminal stuff and I got here when I try to install Nvidia driver. Btw how can I accept your answer?
  • Sergiy Kolodyazhnyy
    Sergiy Kolodyazhnyy about 9 years
    Gray check mark next to up down arrows on the left. When I come back home, I am going to improve my answer here, so it should help you navigate terminal easier
  • Berkay Buğra Saygi
    Berkay Buğra Saygi about 9 years
    Thank you so much, I'm re-installing it though, I think I deleted something about x server and couldn't log in anymore I tried everything I can but didn't help. Btw what is the simplest way to install a graphic card drive? From a .run file. Or is there .deb or .rpm driver file which provided by nvidia?