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组合实现系统备份