===文件打包、压缩
==打包 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
?
?