Top 8 use cd command in Linux

How to change directory in Linux Terminal

CD (Change Directory) command

cd command is used to move about in different directory file system. Directories are found in file hierarchy system in all Computer operating systems. Root (represented by /) is at top of Linux file hierarchy. All directories are above root in Linux. By default when you log into your Linux system your home directory is presented to you. From home directory you can use cd command to change directory in Linux Operating system

cd refers to change directory.

Changing to root directory

Root as already discussed is represented by /, so use command

cd /

This will change your working directory to root.

Changing to other directories

You can use either relative path or absolute path to change to other directories. Absolute path is path where directory position is mentioned in reference to root.

cd /var/vnc

Relative path is path in reference to present working directory.

cd /new/xyz

Change to one directory up

To change to one directory up use

cd..

This command will move you one directory above your current working directory

Return to your home directory

Simply use cd / cd~ command and you will return to your home directory

cd
cd~

Change to home directory of user root

Root is super user in Linux with administrator rights. In case you want to switch to root home directory you will have use su – command.

su–

System will ask you for root password, provide the same and you are in root home directory

Change to other user’s

Other user can be accessed by root user. To change to other user use command su followed by user name

su test