Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux教程

紅旗 Linux 6.0 桌面版:七個常用的檔案操作指令

整理七條在紅旗 Linux 6.0 桌面版上很實用的指令,都是日常會反覆用到的動作。

1. 複製單一檔案

cp /root/install.log /home

2. 複製整個目錄

cp -r /opt/Mplayer1.0rc1

3. 刪除單一檔案

rm /root/install.log

4. 不確認直接刪除多個檔案

rm -f /root/install.log(可搭配萬用字元)

5. 刪除空目錄

rmdir /mnt/xpc xpd xpe

6. 遞迴刪除目錄及其內容

rm -r /mnt/xpc xpd xpe

7. 重新命名

mv /root/install.log /home/lnstall.sys

兩個我踩過的坑

a. 想在 /mnt 底下一次建好幾個目錄,結果 mkdir /mnt/xpc xpd xpe 只有 xpc 建在 /mnt,xpd 與 xpe 跑到目前的 root 目錄去了。改成 mkdir /mnt/xpc /mnt/xpd /mnt/xpe 才如願。

b. 刪除時同理,rm -rf /mnt/xpc xpd xpe 只刪得掉 xpc,另外兩個還在;寫成 rm -rf /mnt/xpc /mnt/xpd /mnt/xpe 才全部清乾淨。

結論很簡單:路徑要嘛每個都寫完整,要嘛先 cd 進目標目錄再操作。

Copyright © Linux教程網 All Rights Reserved