0% found this document useful (0 votes)
3 views2 pages

Cmds 3

The 'cd' command in Linux is used to change the current working directory. It has various functionalities, such as navigating to the root directory, moving into subdirectories, returning to the home directory, and accessing directories with spaces in their names. Examples include 'cd /', 'cd ~', and 'cd "dir name"'.

Uploaded by

dagmawitlegesse6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Cmds 3

The 'cd' command in Linux is used to change the current working directory. It has various functionalities, such as navigating to the root directory, moving into subdirectories, returning to the home directory, and accessing directories with spaces in their names. Examples include 'cd /', 'cd ~', and 'cd "dir name"'.

Uploaded by

dagmawitlegesse6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

cd command in Linux with Examples

cd command in linux known as change directory command. It is used to change current working
directory.

Syntax:

$ cd [directory]

To move inside a subdirectory : to move inside a subdirectory in linux we use

$ cd [directory_name]

In the above example, we have checked number of directories in our home directory and moved
inside the Documents directory by using cd Documents command.

Different functionalities of cd command :

 cd /: this command is used to change directory to the root directory, The root directory is
the first directory in your filesystem hierarchy.

$ cd /

Above, / represents the root directory.

 cd dir_1/dir_2/dir_3: This command is used to move inside a directory from a directory

$ cd dir_1/dir_2/dir_3

In above example, we have the document directory and inside the document directory we
have a directory named geeksforgeeks and inside that directory we have example
directory. To navigate example directory we have used command cd
Documents/geeksforgeeks/example.

 cd ~ : this command is used to change directory to the home directory.

$ cd ~

or

$ cd

cd : this commad also work same as cd ~ command.


cd .. : this command is used to move to the parent directory of current directory, or the
directory one level up from the current directory. “..” represents parent directory.
$ cd ..

 cd “dir name”: This command is used to navigate to a directory with white


spaces.Instead of using double quotes we can use single quotes then also this command
will work.

$ cd "dir name"

In above example, we have navigated the My songs directory by using cd “My songs”
command.

or

$ cd dir\ name :

this command work same as cd “dir name” command.

You might also like