linux命令集(處理檔案)
阿新 • • 發佈:2021-08-02
20210802
ls -F顯示,目錄帶/檔案不帶
ls -FR 遞迴顯示目錄和檔案
ls -d 只顯示當前資料夾
ls -l 顯示長列表,詳細資訊 第一個變數:目錄(d)、檔案(-)、字元型檔案(c),塊裝置(b)
ls -l my_script 顯示my_script的詳細資訊
touch test_one 建立空檔案test_one
touch -a test_one 只改變訪問時間
ls -l –time=atime test_one 顯示訪問時間
cp a.txt b.txt
cp -i a.txt b.txt詢問是否覆蓋
cp a.txt /home/ 最後一個斜線必要!
cp -R scripts/ mod_Scripts 建立Scripts的副本資料夾
mv /home/fzll /home/a/fall 移動檔案並重命名
rm -i fall 詢問是否刪除fall
rm -f 強制刪除
mkdir 建立目錄(資料夾)
mkdir -p new_dir/sub_dir/under_dir
rmdir new_dir 刪除空目錄
rm -r my_dir
rm -rf small_dir
tree small_dir
file a.txt 顯示檔案的型別,編碼,連結檔案等
cat -b 有文字的行加行號
cat -T 代替製表符
tail -n 2 a.txt 顯示尾2行
head -5 a.txt 顯示前五行