tar -cvf 文件名 文件夹 <==仅打包,不压缩!
tar -zcvf 文件名 文件夹 <==打包后,以 gzip 压缩
tar -jcvf 文件名 文件夹 <==打包后,以 bzip2 压缩
例:
tar -zcvf test.tar.gz test
排除指定文件:
排除test目录下a文件夹
tar -zcvf test.tar.gz --exclude=test/a test
排除test目录下a、b文件夹
tar -zcvf test.tar.gz --exclude=test/a --exclude=test/b test