Linux tar 压缩用法
🕙2023-01-30
压缩/etc目录
tar -czvf myetc.tar.gz /etc
解压缩到mytest目录
tar -xzvf myetc.tar.gz -C mytest
压缩tomcat目录,排除 tomcat/logs 目录
tar -zcvf tomcat.tar.gz --exclude=tomcat/logs tomcat
如果要排除多个目录,增加 --exclude 即可,如下命令排除logs和libs两个目录及文件xiaoshan.txt
tar -zcvf tomcat.tar.gz --exclude=tomcat/logs --exclude=tomcat/libs --exclude=tomcat/xiaoshan.txt tomcat