天天看點

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組合實作系統備份

繼續閱讀