文件查找
1.命令文件查找
which ls //查找ls的位置
2.任意文件
按文件名
find /etc -name “hosts”
find /etc -iname “Hosts” //忽略大小写
find /etc -iname “hos*”
按文件大小
find /etc -size +5M
find /etc -size 5M
指定查找的目录深度
find / -maxdepth 4 -a -name “ifcfg-en*”
按文件属主、属组找
find /home -user jack
按文件类型
find /tmp -type f
find /tmp -type b
按文件权限
find .-perm 644 -ls //找到后默认是显示文件
find /etc -name “775*” -delete //找到后删除
find /etc -name “ifcfg*” -ok cp -rvf {} /tmp \; //找到后复制
文件打包及压缩
tar -cf etc.tar /etc
tar -cJf etc-xzip.tar.xz /etc/ //xzip
tar -czf etc-gzip.tar.gz /etc/ //压缩
tar -xvf etc2.tar.bz2 -C /tmp //解压重定向