tar 打包命令

Usage: tar -[cxtzjhmvO] [-X FILE] [-T FILE] [-f TARFILE] [-C DIR] [FILE]...

Create, extract, or list files from a tar file

Operation:
c Create    创建
x Extract  释放
t List        文件列表
f Name of TARFILE ('-' for stdin/out)  使用档案文件或设备,一般是必选的
C Change to DIR before operation
v Verbose  报告tar处理的文件信息
z (De)compress using gzip   用gzip来压缩/解压缩
j (De)compress using bzip2  用bzip2进行压缩
O Extract to stdout             展开到标准输出     
h Follow symlinks
m Don't restore mtime
exclude File to exclude
X File with names to exclude
T File with names to include

一般打包一个文件 可以用 tar -cvf 创建的文件名 需要打包的文件;

打包并压缩文件 :tar -zcvf 创建的文件名 需要打包的文件;

解包: tar -xvf 包文件;

解压缩包: tar -zxvf 包文件

如果是bzip2压缩的包

tar -jxvf 包文件

原文地址:https://www.cnblogs.com/yemeng/p/4058784.html