About "cd" command in terminal mode ( / or \ ) to navigate

Asked by Gismond Tremblay

Sorry i am new to Linux about the help with oubuntu for the change directory "cd"
command help guide say we shoud write cd /Music from home directory
and i was trying it many time and it was not working so i tried cd \Music
and it works so just to let people responsible to have Help corrected

here a copy of what we get in help advance for

The ~ character represents the current user's home directory. As seen above, cd ~ is equivalent to cd /home/username/. However, when running a command as root (using sudo, for example), ~ points instead to /root. When running a command with sudo, the full path to your home directory must be given.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu bash Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
ealthuis (ealthuis) said :
#1

in terminal type "help cd" for the info on the cd command

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#2

Some terminal commands to...:

cd

same as:

cd $HOME

then

cd Music

or

cd ./Music

or

cd Music

or

cd $HOME/Music

to get the working path after changing dir, type:

pwd

Hope this helps

Revision history for this message
Adam Buchbinder (adam-buchbinder) said :
#3

In more detail: the directory structure, assuming your login name is "tremblay", contains the directory "/home/tremblay/Music". If your current directory (use the "pwd" command to print it) is "/home/tremblay", you can type "cd Music" to move into "/home/tremblay/Music". If the path you give to the "cd" command begins with a forward slash, the shell will interpret it as a full path, which isn't what you want.

As a shorthand, you can use "~" for your home directory, so "cd ~" is the same as "cd /home/tremblay", and "cd ~/Music" is the same as "cd /home/tremblay/Music". (Note that you *cannot* use "cd ~Music"; that's shorthand for something else.)

Please don't hesitate to ask if you have any other questions. If you'd like a guided tour around the Linux shell, there's a pretty good introductory tutorial on using the shell here:

http://www.linuxcommand.org/learning_the_shell.php

The section of the tutorial which focuses on navigating around the filesystem with "cd" is here:

http://www.linuxcommand.org/lts0020.php

If the tutorial you were reading said you should type "cd /Music", it's incorrect; if you'd like to link to it or let me know where you saw it, I'll send a note to the maintainer to fix that.

Can you help with this problem?

Provide an answer of your own, or ask Gismond Tremblay for more information if necessary.

To post a message you must log in.