命令簡介:
該命令用來切換當前目錄。cd 是change directory 的縮寫
命令語法:
cd [-L|-P] [dir]
使用示例
1:切換到當前目錄的上一級目錄
1: [root@DB-Server sysconfig]# pwd
2: /etc/sysconfig
3: [root@DB-Server sysconfig]# cd ..
4: [root@DB-Server etc]# pwd
5: /etc
2:切換到當前目錄的上上兩層目錄
1: [root@DB-Server etc]# cd sysconfig/
2: [root@DB-Server sysconfig]# pwd
3: /etc/sysconfig
4: [root@DB-Server sysconfig]# cd ../..
5: [root@DB-Server /]# pwd
6: /
3:切換到用戶的宿主目錄
1: [root@DB-Server sysconfig]# pwd
2: /etc/sysconfig
3: [root@DB-Server sysconfig]# cd ~
4: [root@DB-Server ~]# pwd
5: /root
4:切換到根目錄
1: [root@DB-Server ~]# cd /
2: [root@DB-Server /]#
5:切換到某個目錄,例如/etc/sysconfig/
1: [root@DB-Server ~]# cd /etc/sysconfig/
6: 返回進入當前目錄前所在目錄
1: [root@DB-Server ~]# cd /etc/sysconfig/
2: [root@DB-Server sysconfig]# cd -
3: /root