-4

I'm try to change to my Desktop directory from the terminal.

Running

cd /home/desktop

gives an error in the terminal saying no directory found.

What am I doing wrong?

Eliah Kagan
  • 116,445
  • 54
  • 318
  • 493
Siddhant
  • 39
  • 1
  • 2
  • Related: [Downloaded a program to my home/downloads folder and can't access it](https://askubuntu.com/questions/425574/downloaded-a-program-to-my-home-downloads-folder-and-cant-access-it) – Eliah Kagan Oct 12 '17 at 06:56

4 Answers4

7

iBelieve's answer covers almost everything, but alternatively you can type

cd ~/Desktop/

the ~/ stands for /home/$USER/ or $HOME/

Zanna
  • 69,223
  • 56
  • 216
  • 327
Akisame
  • 3,283
  • 6
  • 31
  • 61
5

To answer your question mentioned in the quoted article:

The directory format is like this:

/
    home
        <username>
            Desktop
            Documents
            ...

so your command should be

cd /home/$USER/Desktop

To learn the directory structure, I'd suggest opening up the Home Folder app from the launcher on the left, and going to Computer and just exploring for a while. You won't be able to break anything outside of your home folder.

Rinzwind
  • 293,910
  • 41
  • 570
  • 710
iBelieve
  • 5,384
  • 3
  • 30
  • 58
5

Because I haven't seen it mentioned yet, it should be noted that all directory names in Ubuntu (Linux) are case-sensitive. So even if you were in your correct home directory, executing a cd desktop should and will fail. If you look at @iBelieve's post, you can see that the Desktop directory starts with a capital 'D'. To get there, you will need to specify the correct case.

cd Desktop

To help you in the future, take a look at this Ubuntu help wiki page on using the terminal.

Zanna
  • 69,223
  • 56
  • 216
  • 327
Aaron
  • 6,646
  • 5
  • 34
  • 48
1

The following bash builtin commands are equivalent and they change the current working directory to your Desktop directory from your user home directory:

cd ~/Desktop               # my favorite

cd ~; cd Desktop

cd ~ && cd Desktop

cd $HOME/Desktop

cd /home/$USER/Desktop

cd /home/username/Desktop  # where 'username' is your user name

cd $CDPATH && cd Desktop

cd `locate -b '\Desktop'`

cd $(locate -b '\Desktop')
Radu Rădeanu
  • 166,822
  • 48
  • 327
  • 400