Linux命令學習總結:cd命令


命令簡介:

    該命令用來切換當前目錄。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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM