cd - Unix, Linux Command


Advertisements

Previous Page
Next Page  
 

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.

OPTIONS

TAG DESCRIPTION
-L force symbolic links to be followed
-P

use the physical directory structure without following symbolic links

EXAMPLES

EXAMPLE-1:

To change directory to /var/log :

$ cd /var/log

output:
$ pwd
/var/log

EXAMPLE-2:

To change directory to parent directory.

$ cd ..

output:
$ pwd
/home/user

EXAMPLE-3:

To force symbolic links to be followed while changing directory.

$ cd -L /home/user
Note: user  is symbolic link to another directory.

EXAMPLE-4:

To use the physical directory structure without following symbolic links while changing directory.

$ cd -P /home/user Note: user is symbolic link to another directory.

EXAMPLE-5:

To move to your home directory:
if our username is abc, and our home directory is /home/abc , the command:

$ cd ~
or
$ cd /home/abc

EXAMPLE-6:

To Move two directory up from where you are now.

nubo@nubo:/var/log$ cd ../../

nubo@nubo:/$

EXAMPLE-7:

To Move to root directory:

nubo@nubo:~$ cd /
nubo@nubo:/$



Previous Page
Next Page