标签:工具 内容 不同 fan 比较 gunzip ext 自动生成 pre
gz、bz2、xz、zip、zcompress、uncompress,压缩比较小gzip /path/to/somefilefile自动生成file_name.gz,且删除源文件,压缩比>10
[root@localhost fangqihan]# ls
1.txt
[root@localhost fangqihan]# gzip 1.txt
[root@localhost fangqihan]# ls
1.txt.gz 解压:
[root@localhost fangqihan]# ls
1.txt.gz
[root@localhost fangqihan]# gunzip 1.txt.gz
[root@localhost fangqihan]# ls
1.txt不解压查看数据:
[root@localhost fangqihan]# ls
1.txt.gz
[root@localhost fangqihan]# zcat 1.txt.gz
haha
hello linux
-bash: asas: 未找到命令
wewe.bz2-k: 压缩后保留源文件bunzip2 file_pathbzcat.xzyum install xz-k: 压缩后保留源文件unxz file_pathxzcatyum install zipzip FILE.zip file1,file2, ...[root@localhost fangqihan]# zip total.zip 1.txt a.txt c.txt
adding: 1.txt (stored 0%)
adding: a.txt (deflated 42%)
adding: c.txt (deflated 31%)
[root@localhost fangqihan]# ls
1.txt a.txt b.txt c.txt total.zip
unzipyum install unzip # 先安装unzip
[root@localhost fangqihan]# ls
c.txt total.zip
[root@localhost fangqihan]# unzip total.zip
Archive: total.zip
extracting: 1.txt
inflating: a.txt
replace c.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
inflating: c.txt
[root@localhost fangqihan]# ls
1.txt a.txt c.txt total.zip
-c:创建归档文件-f FILE.tar:操作的归档文件tar -cf test.rar pattren
# 将所有以test开头的文件归档起来
[root@localhost fangqihan]# ls
1.txt a.txt c.txt
[root@localhost fangqihan]# tar -cf test.rar *.txt
[root@localhost fangqihan]# ls
1.txt a.txt c.txt test.rar还原归档:tar -xf file.tar,解压归档后的文件
[root@localhost fangqihan]# ls
test.rar
[root@localhost fangqihan]# tar -xf test.rar
[root@localhost fangqihan]# ls
1.txt a.txt c.txt test.rar-xattrs归档时,保留文件的扩展属性信息-t: 不展开归档,直接查看归档了哪些文件 tar -tf file.tar
[root@localhost fangqihan]# tar -tf test.rar
1.txt
a.txt
c.txt归档后可以再进行压缩:xz file.tar
[root@localhost fangqihan]# xz test.rar
[root@localhost fangqihan]# ls
test.rar.xz标签:工具 内容 不同 fan 比较 gunzip ext 自动生成 pre
原文地址:https://www.cnblogs.com/fqh202/p/9438691.html