-
touch : 建立檔案或是更改時間
-
mkdir : MaKe DIRectory 建立資料夾
-
rm : ReMove 刪除資料
rmdir : 刪除資料夾
rm -r : rm -r text 刪除名叫 text 得資料夾
rm -f <file> : 強制刪除檔案
-
mv : MoVe 移動檔案或是改檔名
mv text.text hello : 將 text.txt 檔一到 hello 資料夾內
mv text.txt .. : 將 text.txt 移動上一層資料夾
mv test.txt 123 : 如果沒有 123 資料夾,則是將 text.txt 改名為 123.txt
-
cp : CoPy 複製檔案
cp hello hello2 : 將 hello 複製一份,且命名為 hello2
cp -r 資料夾1 資料夾2 : 複製資料夾要用 cp -r
-
grep : 抓取關鍵字
grep zero ciao : 從 ciao 檔案內抓出 zero 關鍵字
-
wget : 下載檔案
wegt 圖片連結網址 :下載圖片
open 檔案名稱 :打開檔案
wget 網頁網址 : 下載網頁原始碼
cat 網頁原始碼檔案 :看網頁原始碼內容
grep 2 網頁原始碼檔案 : 將網頁原始碼檔案中的 2 找出來
-
curl :送出 request
curl API 網頁網址:用 get 方把 response 秀出來
curl -I (大寫 i) : 擷取 header 資訊
-
date : 日期時間
-
top : Table Of Processes 印出所有的 process
-
cat : CATenate 連結檔案 或是 把檔案內容顯示出來 (按 q 離開)
-
less : 分頁是顯示檔案內容 (按 q 離開)
cat hello | grep o
// 輸出 hello 檔的內容,將 o 找出來
grep o hello
// 將 hello 檔內的 o 找出來
兩個是一樣的
cat hello | grep o > result
// 輸出 hello 檔內容,然後將 o 找出來後,再將結果導入到 result 檔案內
(如果沒有 result 檔,會自己新建一個檔)
基本指令
pwd: Print Working Directory 印出我在哪ls: LiSt 印出所在資料夾的所有檔案ls -al:把隱藏的檔案也列出來cd: Chang Directory 切換資料夾cd ciao: 去名叫 ciao 的資料夾cd ..: 跳回前一層資料夾cd ~/Downloads/test/ciao: ~/資料夾路徑man: MANual 使用說明書按
q離開clear:清空操作指令
touch: 建立檔案或是更改時間mkdir: MaKe DIRectory 建立資料夾rm: ReMove 刪除資料rmdir: 刪除資料夾rm -r: rm -r text 刪除名叫 text 得資料夾rm -f <file>: 強制刪除檔案mv: MoVe 移動檔案或是改檔名mv text.text hello: 將 text.txt 檔一到 hello 資料夾內mv text.txt ..: 將 text.txt 移動上一層資料夾mv test.txt 123: 如果沒有 123 資料夾,則是將 text.txt 改名為 123.txtcp: CoPy 複製檔案cp hello hello2: 將 hello 複製一份,且命名為 hello2cp -r 資料夾1 資料夾2: 複製資料夾要用cp -rgrep: 抓取關鍵字grep zero ciao: 從 ciao 檔案內抓出 zero 關鍵字wget: 下載檔案wegt 圖片連結網址:下載圖片open 檔案名稱:打開檔案wget 網頁網址: 下載網頁原始碼cat 網頁原始碼檔案:看網頁原始碼內容grep 2 網頁原始碼檔案: 將網頁原始碼檔案中的 2 找出來curl:送出 requestcurl API 網頁網址:用 get 方把 response 秀出來curl -I (大寫 i): 擷取 header 資訊date: 日期時間top: Table Of Processes 印出所有的 processcat: CATenate 連結檔案 或是 把檔案內容顯示出來 (按 q 離開)less: 分頁是顯示檔案內容 (按 q 離開)指令組合技
>:會把原本檔案的內容覆蓋掉>>:在原檔案內新增內容|: Pipe 左邊的指令輸出 右邊指令輸入