其他分享
首页 > 其他分享> > Ops-tar命令实用总结

Ops-tar命令实用总结

作者:互联网

温故而知新。
tar Jcvf a.tar.xz /data/a /data/b --exclude=/data/a/lia_recording.sql  --exclude=/data/a/test --exclude=/data/a/uploads/* --exclude="/data/a/\.git*"
tar -cvf test.tgz test/
tar -cvf test.tgz test/ --exclude *.jpg
tar -cvf test.tgz test/ --exclude *.txt --exclude *.jpg
tar -cvf test.tgz test/ --exclude a.txt
tar -cvf test.tgz test/ --exclude dir1
tar -cvf test.tgz test/ --exclude dir1 --exclude a.log --exclude *.jpg

tar -zcvf test.tar.gz --exclude=test/1/*.log test
tar -zcvf test.tar.gz --exclude=/test\/1\/.*log/ test
tar -zcvf test.tar.gz --exclude=test/1/6 --exclude=test/2 test
tar -zcvf test.tar.gz --exclude=1/6 --exclude=2 test

其中:
        --exclude=/data/li/test 和 --exclude=/data/li/test/在过滤的时候有所不同。如果需要排除掉某个目录的时候,需要使用"--exclude=/data/li/test"。目录后不能加"/";或者使用--exclude=/data/li/test/*

标签:tar,Ops,tgz,实用,cvf,test,exclude,data
来源: https://blog.51cto.com/mjunetwslinux/2373266