4

I am completely new to Ubuntu or any distribution of linux altogether. While using the terminal, when i am in the /home/username directory the ls command shows Desktop and Download directories but the command cd /Desktop does not work. it says bash: cd: /Desktop: No such file or directory.

Another directory, which i made manually, opens up ok. it also does this with many other folders, what am i doing wrong here.

3 Answers 3

6

In UNIX systems the "/" is always the main folder (the start of the tree).

When you are in /home/username you have to write relative path to this directory in order to navigate deeper in the tree e.g. cd Desktop (without "/" in front of Desktop) or you can use the absolute path

cd /home/username/Desktop

but absolute paths are usually not a good way to move in the tree, because if you are somewhere in a deep place in the tree you don't want to write all the folders just to get one level deeper or go to at the upper level.

To move one level upper you have to write cd ../ which is again relative to the folder where you are at the moment.

1
  • In my home directory there are only two users, git and vmwaretools?!
    – Black
    Jul 19, 2016 at 8:07
4

If you type /Desktop with the / before the word Desktop, for linux it means you want to go to the root directory which is / and then go to the Desktop folder. That means that the Desktop folder would not be in /home/username/Desktop but in /Desktop which would be the error here.

In your case and everybody else, the Desktop folder is normally in the /home/username/Desktop.

So if you open the terminal and you are already in your user directory, for example /home/username then you only need to just type cd Desktop because you are already in the directory where desktop is.

If you were in for example /var/www and you want to go to your desktop you would type one of the following:

  1. cd ~/Desktop which is the same as typing /home/username/Desktop because the ~ will by default point you to the directory of your username. Think of it like ~ is equal to /home/username.
  2. cd /home/username/Desktop
  3. Or doing it by steps: cd /home, cd username, cd Desktop.. at last!

to know in what directory you are in type pwd (Print Working Directory). Also remember that everything is case sensitive. Desktop is not the same as desktop or DeskTOP

Here are some images of what it looks like to me when I open the terminal and go to Desktop. The first image says Desktop/ because I typed "des" and then pressed TAB (which autocompletes the word and adds the trailing / symbol. The second one I typed Desktop:

enter image description here

enter image description here

Now the next 2 images are if you start from another place. In this case we are in /var/www/:

enter image description here

enter image description here

2

Try using:

cd /home/YOUR-USER-NAME-HERE/Desktop

A shortcut for /home/YOUR-USER-NAME-HERE/ is ~/, so the following should also work:

cd ~/Desktop

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .