创建打包文件(*.tar)
# tar cf <tar_file> <src_file>
c:创建
f:指定打包文件名称
解包
# tar xf <tar_file> [-C <dir>]
x:解包
-C:指定解包路径
压缩打包、压缩解包
压缩打包: *.tar.gz
tar zcf /tmp/etc.tar.gz /etc/
压缩解包
tar zxf /tmp/etc.tar.gz -C /uplooking/
压缩打包: *.tar.bz2
tar jcf /tmp/etc.tar.bz2 /etc/
压缩解包
tar jxf /tmp/etc.tar.bz2 -C /uplooking/
压缩打包: *.tar.xz
tar Jcf /tmp/etc.tar.xz /etc/
压缩解包
tar Jxf /tmp/etc.tar.xz -C /uplooking/
网友评论