Linux系統備份:tar 、find

1、tar options <.tar> <file>

-c   打包

-x   解包

-t   無出壓縮包文件名

-z   gzip壓縮

-j   bzip2壓縮

-v   顯示壓縮過程

-f   後跟文件名

-p   保留屬性

--exclude file 不包括

-C   解包時,指定解壓存放目錄,打包時,指定tar存放目錄

    tar -cjf file.tar -C /tmp file1 file2 file3

    tar -xjf file.tar -C ~/

2、find

find path options -print(默認輸出至屏幕,-print省略)

find path options -exec command   {} \; (或-ok)

find path options | xargs command

options

-name | -perm | -user | -group | -nogroup | -nouser    # 易懂、常用,未解釋

-mtime -n,+n   修改時間,文件內容變化    -n 3     # 3天以內

-atime -n,+n       訪問時間                  +n 3     # 3天以前

-ctime -n,+n       狀態時間,文件屬性變化

-prune     忽略指定目錄

-size              文件大小

-depth             查找時,進行某一子目錄時,先查完本目錄

-newer     按更改時間來比較

-fstype            某一類型文件系統內的文件

-type b d c p l f  文件類型

-mount             不跨文件系統

-follow            如遇符號鏈接,跟蹤到原文件

3、tar、find組合實現系統備份


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章