Terminal command cd (change directory) directly

Solution 1:

I'm not very good in english, so this will be just a rough explanation.

If you enter

cd /Pictures/www

into the command line, your pc would search for a directory called Pictures at the beginning of your filesystem and then search for a subdirectory called www. Maybe it would be best if you would open nautilus (or any other filebrowser of your choosing) and you would enter "/" into the adress bar (without the quotes). You now should see the beginning of your filesystem, this is like the C:/windows directory on windows. If you now want to go to your own home folder (the folder where you have your pictures and documents etc.) doupleclick on the home folder and then on the folder with your username. Another way to access your home folder would be to enter "~" into your adress bar (without quotes again).

Now to the command line stuff. If you want to go to your own Pictures folder, this would mean you would need to enter

cd ~/Pictures

the cd is the command "change directory" and the "~" says the pc should change into your home directory. adding "/Pictures" after the "~" now says the pc is supposed to change directory into the subfolder "Pictures" of your home or "~" directory.

The "/www" was just an example as another subfoldername.

Another example: suppose I would want to cd into the subfolder "Develop" (without the quotes) of the folder "Documents" (without the quotes) in my home directory. I now would need to enter

cd ~/Documents/Develop

If you already are in your home directory (if you start a terminal it says ~$, this mean you are inside your "~" directory or home directory) you can just enter

cd Pictures

and you do not need to enter the "~/" anymore.

I hope i could help

Solution 2:

Use

cd /home/mj/Pictures

Can you see the difference between

cd /home/mj/Pictures/

and

cd /Pictures/www

The leading slash means the root folder of your file system. If you are in /home/mj/, than use a relative path, without the leading / or an absolute and complete path /home/mj/Pictures/.


NAME
    cd - Change the shell working directory.

SYNOPSIS
    cd [-L|-P] [dir]

DESCRIPTION
    Change the shell working directory.

    Change the current directory to DIR.  The default DIR is the value of the
    HOME shell variable.

    The variable CDPATH defines the search path for the directory containing
    DIR.  Alternative directory names in CDPATH are separated by a colon (:).
    A null directory name is the same as the current directory.  If DIR begins
    with a slash (/), then CDPATH is not used.

    If the directory is not found, and the shell option `cdable_vars' is set,
    the word is assumed to be  a variable name.  If that variable has a value,
    its value is used for DIR.

    Options:
        -L  force symbolic links to be followed
        -P  use the physical directory structure without following symbolic
        links

    The default is to follow symbolic links, as if `-L' were specified.

    Exit Status:
    Returns 0 if the directory is changed; non-zero otherwise.