Linux 基本指令

cd指令
從 Home 去 Documents 這個文件夾

~$ cd Documents/
~/Documents$ 

返回上一級目錄

~/Documents$ cd ..  
~$

去往子文件夾

~$ cd Documents/folder1/
~/Documents/folder1$

返回你剛剛所在的目錄

~/Documents/folder1$ cd -
/home/morvan
~$

向上返回兩次

~/Documents/folder1$ cd ../../
~$

去往 Home

~/Documents/folder1$ cd ~
~$

去往電腦任何地方, 你需要的是一個絕對路徑

~$ cd /home/morvan/Documents/folder1
~/Documents/folder1$

ls 指令
輸出詳細信息 -l (long 的簡寫). 這個指令會打印出文件的權限 (-rw-rw-r-- 之後我們在細說這個), 用戶名, 文件大小, 修改日期, 文件名

~/Documents$ ls -l
total 4
-rw-rw-r-- 1 morvan morvan    0 Oct 12 07:38 file1
drwxrwxr-x 2 morvan morvan 4096 Oct 12 07:26 folder1

-a (all 的簡寫) 顯示所有文件 . 這裏還會顯示隱藏的文件 (以 . 開頭的)

$ ls -a
.  ..  file1  folder1  .hidden_file

-lh (human), 直接 -l 不方便人看, 這個指令是爲了方便給人觀看的. 注意這裏的文件大小使用了 K, MB, GB 之類概括

$ ls -lh
total 4.0K
-rw-rw-r-- 1 morvan morvan    0 Oct 12 07:38 file1
drwxrwxr-x 2 morvan morvan 4.0K Oct 12 07:26 folder1

還有很多其他的功能, 我們可以通過 --help 來查看

$ ls --help
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章