CD: Switch to the current working directory

[root@yang-1 ~]# cd /etc/
[root@yang-1 etc]# cd
[root@yang-1 ~]#
Copy the code

CD – : goes to the previous directory

[root@yang-1 ~]# cd -
/etc
[root@yang-1 etc]# pwd
/etc
[root@yang-1 etc]# cd -
/root
[root@yang-1 ~]# pwd
/root
[root@yang-1 ~]#
Copy the code

CD: home directory of the current user

[root@yang-1 etc]# cd
[root@yang-1 ~]#
Copy the code

CD ~ : indicates the user’s home directory

[root@yang-1 ~]# cd ~
[root@yang-1 ~]#
Copy the code

cd .. : Goes to the upper-level directory

[root@yang-1 ~]# 
[root@yang-1 ~]# cd ..
[root@yang-1 /]#



[root@yang-1 /]# cd /etc/sysconfig/network-scripts/
[root@yang-1 network-scripts]# cd ..
[root@yang-1 sysconfig]# pwd
/etc/sysconfig
[root@yang-1 sysconfig]# cd ..
[root@yang-1 etc]# pwd
/etc
[root@yang-1 etc]# cd ..
[root@yang-1 /]# pwd
/
[root@yang-1 /]#
Copy the code