幾個命令
- cd -change directory
- pwd -Pring name of current Working directory
- ls -List directory contents
這幾個命令都很容易理解。
絕對路徑與相對路徑
An absolute pathname begins with the root directory and follows the tree branch by branch until the path to the desired directory or file is completed.
Where an absolute pathname starts from the root directory and leads to its destination, a relative pathname starts from the working directory.
對于絕對路徑,我們要列出整個的的文件路徑進入,如:
cd /usr/local
而相對路徑則是相對于當前工作目錄而言,用.
和..
來操作,如
#當前目錄 `/usr/local`,要進入`/usr` 有兩種方法
cd /usr #絕對路徑
cd .. #相對路徑
在進入子目錄的時候,比如當前是/usr
,進入子文件夾
cd ./local
通常./
是可以省略的,
cd local
有用的快捷鍵
cd #到home directory
cd - #到上一個工作路徑
cd ~user_name #到某個用戶的home directory
ls -a #連隱藏文件也列出來