linux的tar怎么解包,linux下怎么打包压缩?解包解压?tar文件.gz文件

===文件打包、压缩

==打包 tar

?

[root@521478.com]# tar -cvf etc1.tar /etc//c创建 v详细 f打包后文件名

[root@521478.com]# tar -cf etc2.tar /etc

[root@521478.com]# ll -h etc*

-rw-r--r-- 1 root root 104M 10-29 12:10 etc1.tar

-rw-r--r-- 1 root root 104M 10-29 12:11 etc2.tar

?

?

?

==压缩 gzip bzip2 xz

?

[root@521478.com]# gzip etc1.tar

[root@521478.com]# bzip2 etc2.tar

[root@521478.com]#

[root@521478.com]# ll -h etc*

-rw-r--r-- 1 root root 12M 10-29 12:10 etc1.tar.gz

-rw-r--r-- 1 root root 8.0M 10-29 12:11 etc2.tar.bz2

?

?

===打包压缩===

?

[root@521478.com]# tar -czf etc1.tar.gz /etc//-z 调用gzip

[root@521478.com]# tar -cjf etc2.tar.bz2 /etc//-j 调用bzip2

?

?

?

?

?

?

?

?

===文件解压、解包

==解压 -d

?

[root@521478.com]# gzip -d etc1.tar.gz

[root@521478.com]# bzip2 -d etc2.tar.bz2

?

?

==解包

?

[root@521478.com]# tar -xvf etc1.tar//解包到当前目录

[root@521478.com]# tar -xf etc2.tar -C /var/tmp///-C重定向到/var/tmp目录

?

?

?

===解包,解压===

[root@521478.com]# tar -xvf etc1.tar.gz//无需指定解压工具,tar会自动判断gzip或bzip2

[root@521478.com]# tar -xvf etc2.tar.bz2 -C /tmp

[root@521478.com]# tar xvf etc1.tar.gz

?

?

?

?

补充:

[root@521478.com]# unzip 1.zip

[root@521478.com]# *.rar

?

?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值