1.功能上的區別
- ? mv:用戶可以使用mv為檔案或目錄重命名或將檔案由一個目錄移入另一個目錄中,
- ? cp: cp的功能是將給出的檔案或目錄拷貝到另一檔案或目錄中,
2.inode上的區別(inode是存盤檔案元資訊的區域)
- ? mv:會將存盤于indoe索引節點上的檔案元資訊也移動到新檔案中,
- ? cp : 只會復制檔案資料,不會復制inode索引節點上的檔案元資訊,
測驗效果如下圖所示,執行cp之后inode號發生變化,執行mv之后inode號不變,
[root@node5 ~]# ls -i test.txt
34566858 test.txt
[root@node5 ~]# cp test.txt test1.txt
[root@node5 ~]# ls -i test*
33574991 test1.txt 34566858 test.txt
[root@node5 ~]# mv test.txt test2.txt
[root@node5 ~]# ls -i test*
33574991 test1.txt 34566858 test2.txt
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/205826.html
標籤:其他
