今天了解了一下linux命令中的
mv:
http://www.cnblogs.com/peida/archive/2012/10/27/2743022.html
1.命令格式:
mv [選項] 源文件或目錄 目標文件或目錄
2.命令功能:
視mv命令中第二個參數類型的不同(是目標文件還是目標目錄),mv命令將文件重命名或將其移至一個新的目錄中。當第二個參數類型是文件時,mv命令完成文件重命名,此時,源文件只能有一個(也可以是源目錄名),它將所給的源文件或目錄重命名為給定的目標文件名。當第二個參數是已存在的目錄名稱時,源文件或目錄參數可以有多個,mv命令將各參數指定的源文件均移至目標目錄中。在跨文件系統移動文件時,mv先拷貝,再將原有文件刪除,而鏈至該文件的鏈接也將丟失。+
4.命令實例:
實例一:文件改名
命令:
mv test.log test1.txt
輸出:
[root@localhost test]# ll
總計 20drwxr-xr-x 6 root root 4096 10-27 01:58 scf
drwxrwxrwx 2 root root 4096 10-25 17:46 test3
drwxr-xr-x 2 root root 4096 10-25 17:56 test4
drwxr-xr-x 3 root root 4096 10-25 17:56 test5
-rw-r--r-- 1 root root 16 10-28 06:04 test.log
[root@localhost test]# mv test.log test1.txt
[root@localhost test]# ll
總計 20drwxr-xr-x 6 root root 4096 10-27 01:58 scf
-rw-r--r-- 1 root root 16 10-28 06:04 test1.txt
drwxrwxrwx 2 root root 4096 10-25 17:46 test3
drwxr-xr-x 2 root root 4096 10-25 17:56 test4
drwxr-xr-x 3 root root 4096 10-25 17:56 test5
說明:
將文件test.log重命名為test1.txt
實例二:移動文件
命令:
mv test1.txt test3
輸出:
[root@localhost test]# ll
總計 20drwxr-xr-x 6 root root 4096 10-27 01:58 scf
-rw-r--r-- 1 root root 29 10-28 06:05 test1.txt
drwxrwxrwx 2 root root 4096 10-25 17:46 test3
drwxr-xr-x 2 root root 4096 10-25 17:56 test4
drwxr-xr-x 3 root root 4096 10-25 17:56 test5
[root@localhost test]# mv test1.txt test3
[root@localhost test]# ll
總計 16drwxr-xr-x 6 root root 4096 10-27 01:58 scf
drwxrwxrwx 2 root root 4096 10-28 06:09 test3
drwxr-xr-x 2 root root 4096 10-25 17:56 test4
drwxr-xr-x 3 root root 4096 10-25 17:56 test5
[root@localhost test]# cd test3
[root@localhost test3]# ll
總計 4
-rw-r--r-- 1 root root 29 10-28 06:05 test1.txt
[root@localhost test3]#
說明:
將test1.txt文件移到目錄test3中
實例三:將文件log1.txt,log2.txt,log3.txt移動到目錄test3中。
命令:
mv log1.txt log2.txt log3.txt test3
mv -t /opt/soft/test/test4/ log1.txt log2.txt log3.txt
輸出:
[root@localhost test]# ll
總計 28
-rw-r--r-- 1 root root 8 10-28 06:15 log1.txt
-rw-r--r-- 1 root root 12 10-28 06:15 log2.txt
-rw-r--r-- 1 root root 13 10-28 06:16 log3.txt
drwxrwxrwx 2 root root 4096 10-28 06:09 test3
[root@localhost test]# mv log1.txt log2.txt log3.txt test3
[root@localhost test]# ll
總計 16drwxrwxrwx 2 root root 4096 10-28 06:18 test3
[root@localhost test]# cd test3/
[root@localhost test3]# ll
總計 16
-rw-r--r-- 1 root root 8 10-28 06:15 log1.txt
-rw-r--r-- 1 root root 12 10-28 06:15 log2.txt
-rw-r--r-- 1 root root 13 10-28 06:16 log3.txt
-rw-r--r-- 1 root root 29 10-28 06:05 test1.txt
[root@localhost test3]#
[root@localhost test3]# ll
總計 20
-rw-r--r-- 1 root root 8 10-28 06:15 log1.txt
-rw-r--r-- 1 root root 12 10-28 06:15 log2.txt
-rw-r--r-- 1 root root 13 10-28 06:16 log3.txt
drwxr-xr-x 2 root root 4096 10-28 06:21 logs
-rw-r--r-- 1 root root 29 10-28 06:05 test1.txt
[root@localhost test3]# mv -t /opt/soft/test/test4/ log1.txt log2.txt log3.txt
[root@localhost test3]# cd ..
[root@localhost test]# cd test4/
[root@localhost test4]# ll
總計 12
-rw-r--r-- 1 root root 8 10-28 06:15 log1.txt
-rw-r--r-- 1 root root 12 10-28 06:15 log2.txt
-rw-r--r-- 1 root root 13 10-28 06:16 log3.txt
[root@localhost test4]#
說明:
mv log1.txt log2.txt log3.txt test3 命令將log1.txt ,log2.txt, log3.txt 三個文件移到 test3目錄中去,mv -t /opt/soft/test/test4/ log1.txt log2.txt log3.txt 命令又將三個文件移動到test4目錄中去
實例四:將文件file1改名為file2,如果file2已經存在,則詢問是否覆蓋
命令:
mv -i log1.txt log2.txt
輸出:
[root@localhost test4]# ll
總計 12
-rw-r--r-- 1 root root 8 10-28 06:15 log1.txt
-rw-r--r-- 1 root root 12 10-28 06:15 log2.txt
-rw-r--r-- 1 root root 13 10-28 06:16 log3.txt
[root@localhost test4]# cat log1.txt
odfdfs
[root@localhost test4]# cat log2.txt
ererwerwer
[root@localhost test4]# mv -i log1.txt log2.txt
mv:是否覆蓋“log2.txt”? y
[root@localhost test4]# cat log2.txt
odfdfs
[root@localhost test4]#
實例五:將文件file1改名為file2,即使file2存在,也是直接覆蓋掉。
命令:
mv -f log3.txt log2.txt
輸出:
[root@localhost test4]# ll
總計 8
-rw-r--r-- 1 root root 8 10-28 06:15 log2.txt
-rw-r--r-- 1 root root 13 10-28 06:16 log3.txt
[root@localhost test4]# cat log2.txt
odfdfs
[root@localhost test4]# cat log3
cat: log3: 沒有那個文件或目錄
[root@localhost test4]# ll
總計 8
-rw-r--r-- 1 root root 8 10-28 06:15 log2.txt
-rw-r--r-- 1 root root 13 10-28 06:16 log3.txt
[root@localhost test4]# cat log2.txt
odfdfs
[root@localhost test4]# cat log3.txt
dfosdfsdfdss
[root@localhost test4]# mv -f log3.txt log2.txt
[root@localhost test4]# cat log2.txt
dfosdfsdfdss
[root@localhost test4]# ll
總計 4
-rw-r--r-- 1 root root 13 10-28 06:16 log2.txt
[root@localhost test4]#
說明:
log3.txt的內容直接覆蓋了log2.txt內容,-f 這是個危險的選項,使用的時候一定要保持頭腦清晰,一般情況下最好不用加上它。
實例六:目錄的移動
命令:
mv dir1 dir2
輸出:
[root@localhost test4]# ll
-rw-r--r-- 1 root root 13 10-28 06:16 log2.txt
[root@localhost test4]# ll
-rw-r--r-- 1 root root 13 10-28 06:16 log2.txt
[root@localhost test4]# cd ..
[root@localhost test]# ll
drwxr-xr-x 6 root root 4096 10-27 01:58 scf
drwxrwxrwx 3 root root 4096 10-28 06:24 test3
drwxr-xr-x 2 root root 4096 10-28 06:48 test4
drwxr-xr-x 3 root root 4096 10-25 17:56 test5
[root@localhost test]# cd test3
[root@localhost test3]# ll
drwxr-xr-x 2 root root 4096 10-28 06:21 logs
-rw-r--r-- 1 root root 29 10-28 06:05 test1.txt
[root@localhost test3]# cd ..
[root@localhost test]# mv test4 test3
[root@localhost test]# ll
drwxr-xr-x 6 root root 4096 10-27 01:58 scf
drwxrwxrwx 4 root root 4096 10-28 06:54 test3
drwxr-xr-x 3 root root 4096 10-25 17:56 test5
[root@localhost test]# cd test3/
[root@localhost test3]# ll
drwxr-xr-x 2 root root 4096 10-28 06:21 logs
-rw-r--r-- 1 root root 29 10-28 06:05 test1.txt
drwxr-xr-x 2 root root 4096 10-28 06:48 test4
[root@localhost test3]#
說明:
如果目錄dir2不存在,將目錄dir1改名為dir2;否則,將dir1移動到dir2中。
實例7:移動當前文件夾下的所有文件到上一級目錄
命令:
mv * ../
輸出:
[root@localhost test4]# ll
-rw-r--r-- 1 root root 25 10-28 07:02 log1.txt
-rw-r--r-- 1 root root 13 10-28 06:16 log2.txt
[root@localhost test4]# mv * ../
[root@localhost test4]# ll
[root@localhost test4]# cd ..
[root@localhost test3]# ll
-rw-r--r-- 1 root root 25 10-28 07:02 log1.txt
-rw-r--r-- 1 root root 13 10-28 06:16 log2.txt
drwxr-xr-x 2 root root 4096 10-28 06:21 logs
-rw-r--r-- 1 root root 29 10-28 06:05 test1.txt
drwxr-xr-x 2 root root 4096 10-28 07:02 test4
實例八:把當前目錄的一個子目錄里的文件移動到另一個子目錄里
命令:
mv test3/*.txt test5
輸出:
[root@localhost test]# ll
drwxr-xr-x 6 root root 4096 10-27 01:58 scf
drwxrwxrwx 4 root root 4096 10-28 07:02 test3
drwxr-xr-x 3 root root 4096 10-25 17:56 test5
[root@localhost test]# cd test3
[root@localhost test3]# ll
-rw-r--r-- 1 root root 25 10-28 07:02 log1.txt
-rw-r--r-- 1 root root 13 10-28 06:16 log2.txt
drwxr-xr-x 2 root root 4096 10-28 06:21 logs
-rw-r--r-- 1 root root 29 10-28 06:05 test1.txt
drwxr-xr-x 2 root root 4096 10-28 07:02 test4
[root@localhost test3]# cd ..
[root@localhost test]# mv test3/*.txt test5
[root@localhost test]# cd test5
[root@localhost test5]# ll
-rw-r--r-- 1 root root 25 10-28 07:02 log1.txt
-rw-r--r-- 1 root root 13 10-28 06:16 log2.txt
-rw-r--r-- 1 root root 29 10-28 06:05 test1.txt
drwxr-xr-x 2 root root 4096 10-25 17:56 test5-1
[root@localhost test5]# cd ..
[root@localhost test]# cd test3/
[root@localhost test3]# ll
drwxr-xr-x 2 root root 4096 10-28 06:21 logs
drwxr-xr-x 2 root root 4096 10-28 07:02 test4
[root@localhost test3]#
實例九:文件被覆蓋前做簡單備份,前面加參數-b
命令:
mv log1.txt -b log2.txt
輸出:
[root@localhost test5]# ll
-rw-r--r-- 1 root root 25 10-28 07:02 log1.txt
-rw-r--r-- 1 root root 13 10-28 06:16 log2.txt
-rw-r--r-- 1 root root 29 10-28 06:05 test1.txt
drwxr-xr-x 2 root root 4096 10-25 17:56 test5-1
[root@localhost test5]# mv log1.txt -b log2.txt
mv:是否覆蓋“log2.txt”? y
[root@localhost test5]# ll
-rw-r--r-- 1 root root 25 10-28 07:02 log2.txt
-rw-r--r-- 1 root root 13 10-28 06:16 log2.txt~
-rw-r--r-- 1 root root 29 10-28 06:05 test1.txt
drwxr-xr-x 2 root root 4096 10-25 17:56 test5-1
[root@localhost test5]#
說明:
-b 不接受參數,mv會去讀取環境變量VERSION_CONTROL來作為備份策略。
--backup該選項指定如果目標文件存在時的動作,共有四種備份策略:
1.CONTROL=none或off : 不備份。
2.CONTROL=numbered或t:數字編號的備份
3.CONTROL=existing或nil:如果存在以數字編號的備份,則繼續編號備份m+1...n:
執行mv操作前已存在以數字編號的文件log2.txt.~1~,那么再次執行將產生log2.txt~2~,以次類推。如果之前沒有以數字編號的文件,則使用下面講到的簡單備份。
4.CONTROL=simple或never:使用簡單備份:在被覆蓋前進行了簡單備份,簡單備份只能有一份,再次被覆蓋時,簡單備份也會被覆蓋。
參數:
-b :若需覆蓋文件,則覆蓋前先行備份。
-f :force 強制的意思,如果目標文件已經存在,不會詢問而直接覆蓋;
-i :若目標文件 (destination) 已經存在時,就會詢問是否覆蓋!
-u :若目標文件已經存在,且 source 比較新,才會更新(update)
scp:
http://www.cnblogs.com/peida/archive/2013/03/15/2960802.html
scp是secure copy的簡寫,用於在Linux下進行遠程拷貝文件的命令,和它類似的命令有cp,不過cp只是在本機進行拷貝不能跨服務器,而且scp傳輸是加密的。可能會稍微影響一下速度。當你服務器硬盤變為只讀 read only system時,用scp可以幫你把文件移出來。另外,scp還非常不占資源,不會提高多少系統負荷,在這一點上,rsync就遠遠不及它了。雖然 rsync比scp會快一點,但當小文件眾多的情況下,rsync會導致硬盤I/O非常高,而scp基本不影響系統正常使用。
1.命令格式:
scp [參數] [原路徑] [目標路徑]
2.命令功能:
scp是 secure copy的縮寫, scp是linux系統下基於ssh登陸進行安全的遠程文件拷貝命令。linux的scp命令可以在linux服務器之間復制文件和目錄。
3.命令參數:
-1 強制scp命令使用協議ssh1
-2 強制scp命令使用協議ssh2
-4 強制scp命令只使用IPv4尋址
-6 強制scp命令只使用IPv6尋址
-B 使用批處理模式(傳輸過程中不詢問傳輸口令或短語)
-C 允許壓縮。(將-C標志傳遞給ssh,從而打開壓縮功能)
-p 保留原文件的修改時間,訪問時間和訪問權限。
-q 不顯示傳輸進度條。
-r 遞歸復制整個目錄。
-v 詳細方式顯示輸出。scp和ssh(1)會顯示出整個過程的調試信息。這些信息用於調試連接,驗證和配置問題。
-c cipher 以cipher將數據傳輸進行加密,這個選項將直接傳遞給ssh。
-F ssh_config 指定一個替代的ssh配置文件,此參數直接傳遞給ssh。
-i identity_file 從指定文件中讀取傳輸時使用的密鑰文件,此參數直接傳遞給ssh。
-l limit 限定用戶所能使用的帶寬,以Kbit/s為單位。
-o ssh_option 如果習慣於使用ssh_config(5)中的參數傳遞方式,
-P port 注意是大寫的P, port是指定數據傳輸用到的端口號
-S program 指定加密傳輸時所使用的程序。此程序必須能夠理解ssh(1)的選項。
4.使用實例:
scp命令的實際應用概述:
從本地服務器復制到遠程服務器:
(1) 復制文件:
命令格式:
scp local_file remote_username@remote_ip:remote_folder
或者
scp local_file remote_username@remote_ip:remote_file
或者
scp local_file remote_ip:remote_folder
或者
scp local_file remote_ip:remote_file
第1,2個指定了用戶名,命令執行后需要輸入用戶密碼,第1個僅指定了遠程的目錄,文件名字不變,第2個指定了文件名
第3,4個沒有指定用戶名,命令執行后需要輸入用戶名和密碼,第3個僅指定了遠程的目錄,文件名字不變,第4個指定了文件名
(2) 復制目錄:
命令格式:
scp -r local_folder remote_username@remote_ip:remote_folder
或者
scp -r local_folder remote_ip:remote_folder
第1個指定了用戶名,命令執行后需要輸入用戶密碼;
第2個沒有指定用戶名,命令執行后需要輸入用戶名和密碼;
從遠程服務器復制到本地服務器:
從遠程復制到本地的scp命令與上面的命令雷同,只要將從本地復制到遠程的命令后面2個參數互換順序就行了。
實例1:從遠處復制文件到本地目錄
命令:
scp root@192.168.120.204:/opt/soft/nginx-0.5.38.tar.gz /opt/soft/
輸出:
[root@localhost soft] # ll
總計 80072
drwxr-xr-x 12 root root 4096 09-21 18:40 fms3.5
drwxr-xr-x 3 root root 4096 09-21 17:58 fms4.5
drwxr-xr-x 10 root root 4096 10-30 17:15 jdk1.6.0_16
drwxr-xr-x 10 root root 4096 09-17 19:27 jdk1.6.0_16.bak
-rwxr-xr-x 1 root root 81871260 2009-12-21 jdk-6u16-linux-x64.bin
drwxrwxrwx 2 root root 4096 09-21 01:16 mysql
drwxr-xr-x 3 root root 4096 09-21 18:40 setup_file
drwxr-xr-x 9 root root 4096 09-17 19:23 tomcat6.0.32
drwxr-xr-x 9 root root 4096 2012-08-14 tomcat_7.0
[root@localhost soft] # scp root@192.168.120.204:/opt/soft/nginx-0.5.38.tar.gz /opt/soft/
root@192.168.120.204's password:
nginx-0.5.38.tar.gz 100% 479KB 478.7KB/s 00:00
[root@localhost soft] # ll
總計 80556
drwxr-xr-x 12 root root 4096 09-21 18:40 fms3.5
drwxr-xr-x 3 root root 4096 09-21 17:58 fms4.5
drwxr-xr-x 10 root root 4096 10-30 17:15 jdk1.6.0_16
drwxr-xr-x 10 root root 4096 09-17 19:27 jdk1.6.0_16.bak
-rwxr-xr-x 1 root root 81871260 2009-12-21 jdk-6u16-linux-x64.bin
drwxrwxrwx 2 root root 4096 09-21 01:16 mysql
-rw-r--r-- 1 root root 490220 03-15 09:11 nginx-0.5.38.tar.gz
drwxr-xr-x 3 root root 4096 09-21 18:40 setup_file
drwxr-xr-x 9 root root 4096 09-17 19:23 tomcat6.0.32
drwxr-xr-x 9 root root 4096 2012-08-14 tomcat_7.0
[root@localhost soft] #
說明:
從192.168.120.204機器上的/opt/soft/的目錄中下載nginx-0.5.38.tar.gz 文件到本地/opt/soft/目錄中
實例2:從遠處復制到本地
命令:
scp -r root@192.168.120.204:/opt/soft/mongodb /opt/soft/
輸出:
總計 80556
drwxr-xr-x 12 root root 4096 09-21 18:40 fms3.5
drwxr-xr-x 3 root root 4096 09-21 17:58 fms4.5
drwxr-xr-x 10 root root 4096 10-30 17:15 jdk1.6.0_16
drwxr-xr-x 10 root root 4096 09-17 19:27 jdk1.6.0_16.bak
-rwxr-xr-x 1 root root 81871260 2009-12-21 jdk-6u16-linux-x64.bin
drwxrwxrwx 2 root root 4096 09-21 01:16 mysql
-rw-r--r-- 1 root root 490220 03-15 09:11 nginx-0.5.38.tar.gz
drwxr-xr-x 3 root root 4096 09-21 18:40 setup_file
drwxr-xr-x 9 root root 4096 09-17 19:23 tomcat6.0.32
drwxr-xr-x 9 root root 4096 2012-08-14 tomcat_7.0
[root@localhost soft] # scp -r root@192.168.120.204:/opt/soft/mongodb /opt/soft/
root@192.168.120.204's password:
mongodb-linux-i686-static-1.8.5.tgz 100% 28MB 28.3MB/s 00:01
README 100% 731 0.7KB/s 00:00
THIRD-PARTY-NOTICES 100% 7866 7.7KB/s 00:00
mongorestore 100% 7753KB 7.6MB/s 00:00
mongod 100% 7760KB 7.6MB/s 00:01
mongoexport 100% 7744KB 7.6MB/s 00:00
bsondump 100% 7737KB 7.6MB/s 00:00
mongofiles 100% 7748KB 7.6MB/s 00:01
mongostat 100% 7808KB 7.6MB/s 00:00
mongos 100% 5262KB 5.1MB/s 00:01
mongo 100% 3707KB 3.6MB/s 00:00
mongoimport 100% 7754KB 7.6MB/s 00:00
mongodump 100% 7773KB 7.6MB/s 00:00
GNU-AGPL-3.0 100% 34KB 33.7KB/s 00:00
[root@localhost soft] # ll
總計 80560
drwxr-xr-x 12 root root 4096 09-21 18:40 fms3.5
drwxr-xr-x 3 root root 4096 09-21 17:58 fms4.5
drwxr-xr-x 10 root root 4096 10-30 17:15 jdk1.6.0_16
drwxr-xr-x 10 root root 4096 09-17 19:27 jdk1.6.0_16.bak
-rwxr-xr-x 1 root root 81871260 2009-12-21 jdk-6u16-linux-x64.bin
drwxr-xr-x 3 root root 4096 03-15 09:18 mongodb
drwxrwxrwx 2 root root 4096 09-21 01:16 mysql
-rw-r--r-- 1 root root 490220 03-15 09:11 nginx-0.5.38.tar.gz
drwxr-xr-x 3 root root 4096 09-21 18:40 setup_file
drwxr-xr-x 9 root root 4096 09-17 19:23 tomcat6.0.32
drwxr-xr-x 9 root root 4096 2012-08-14 tomcat_7.0
[root@localhost soft] #
說明:
從192.168.120.204機器上的/opt/soft/中下載mongodb 目錄到本地的/opt/soft/目錄來。
實例3:上傳本地文件到遠程機器指定目錄
命令:
scp /opt/soft/nginx-0.5.38.tar.gz root@192.168.120.204:/opt/soft/scptest
輸出:
[root@localhost soft] # cd scptest/
[root@localhost scptest] # ll
總計 0
[root@localhost scptest] # ll
本地機器上傳:
[root@localhost soft] # scp /opt/soft/nginx-0.5.38.tar.gz root@192.168.120.204:/opt/soft/scptest
root@192.168.120.204's password:
nginx-0.5.38.tar.gz 100% 479KB 478.7KB/s 00:00
[root@localhost soft] #
上傳后目標機器的目標目錄:
[root@localhost scptest] # ll
總計 484
-rw-r--r-- 1 root root 490220 03-15 09:25 nginx-0.5.38.tar.gz
[root@localhost scptest] #
說明:
復制本地opt/soft/目錄下的文件nginx-0.5.38.tar.gz 到遠程機器192.168.120.204的opt/soft/scptest目錄
實例4:上傳本地目錄到遠程機器指定目錄
命令:
scp -r /opt/soft/mongodb root@192.168.120.204:/opt/soft/scptest
輸出:
[root@localhost ~] # cd /opt/soft/scptest/
[root@localhost scptest] # ll
總計 484
-rw-r--r-- 1 root root 490220 03-15 09:25 nginx-0.5.38.tar.gz
[root@localhost scptest] #
本地機器上傳:
[root@localhost ~] # scp -r /opt/soft/mongodb root@192.168.120.204:/opt/soft/scptest
root@192.168.120.204's password:
mongodb-linux-i686-static-1.8.5.tgz 100% 28MB 28.3MB/s 00:01
README 100% 731 0.7KB/s 00:00
THIRD-PARTY-NOTICES 100% 7866 7.7KB/s 00:00
mongorestore 100% 7753KB 7.6MB/s 00:00
mongod 100% 7760KB 7.6MB/s 00:01
mongoexport 100% 7744KB 7.6MB/s 00:00
bsondump 100% 7737KB 7.6MB/s 00:00
mongofiles 100% 7748KB 7.6MB/s 00:00
mongostat 100% 7808KB 7.6MB/s 00:01
mongos 100% 5262KB 5.1MB/s 00:00
mongo 100% 3707KB 3.6MB/s 00:00
mongoimport 100% 7754KB 7.6MB/s 00:01
mongodump 100% 7773KB 7.6MB/s 00:00
GNU-AGPL-3.0 100% 34KB 33.7KB/s 00:00
[root@localhost ~] #
上傳后目標機器的目標目錄:
[root@localhost scptest] # ll
總計 488
drwxr-xr-x 3 root root 4096 03-15 09:33 mongodb
-rw-r--r-- 1 root root 490220 03-15 09:25 nginx-0.5.38.tar.gz
[root@localhost scptest] #
說明:
上傳本地目錄 /opt/soft/mongodb到遠程機器192.168.120.204上/opt/soft/scptest的目錄中去
rm:
rm要加兩個參數-rf 即:rm -rf 目錄名字
-f 就是直接強行刪除,不作任何提示的意思
eg:rm -rf / var/ log/httpd/access
eg:rm -f / var/ log/httpd/access. log