在linux中關于cd命令詳解
Linux中關于cd命令的主要功能是切換當前的目錄,下面由學習啦小編為大家整理了linux中關于cd命令的相關知識,希望對大家有幫助!
linux中關于cd命令詳解
1.命令簡介:
該命令用來切換當前目錄。cd 是change directory 的縮寫
2.命令語法:
cd [-L|-P] [dir]
linux中關于cd命令使用示例
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
在linux中關于cd命令詳解




