压缩工具gzip、bzip2、xz

压缩工具gzip、bzip2、xz

首页枪战射击Gun Man 3D更新时间:2024-04-29

Linux常见压缩文件扩展名如下:

.zip,.gz,.bz2,.xz,.tar.gz,.tar.bz2,.tar.xz

压缩文件解压后可能与源文件大小不一致。

gzip压缩工具

[root@centos01 d6]# ls -lh 1.txt -rw-r--r--. 1 root root 1.3M Sep 30 07:38 1.txt [root@centos01 d6]# [root@centos01 d6]# gzip 1.txt # 压缩1.txt [root@centos01 d6]# ls 1.txt.gz [root@centos01 d6]# ls -lh 1.txt.gz -rw-r--r--. 1 root root 358K Sep 30 07:38 1.txt.gz [root@centos01 d6]# gzip -d 1.txt.gz # 解压缩1.txt.gz [root@centos01 d6]# ls 1.txt [root@centos01 d6]# gunzip 1.txt.gz # gunzip解压1.txt.gz [root@centos01 d6]# ls 1.txt [root@centos01 d6]# gzip -1 1.txt # 默认压缩级别6,范围1-9 [root@centos01 d6]# ls 1.txt.gz [root@centos01 d6]# zcat 1.txt.gz | head -n 5 # 查看压缩文件(加压后打开) # This is an example configuration file for the LVM2 system. # It contains the default settings that would be used if there was no # /etc/lvm/lvm.conf file. # # Refer to 'man lvm.conf' for further information including the file layout. [root@centos01 d6]# gzip -c 1.txt > 1.txt.gz # 压缩时不删除文件,并输出到指定文件 [root@centos01 d6]# ls 1.txt 1.txt.gz [root@centos01 d6]# gunzip -c 1.txt.gz > 1.cp.txt # 不删除压缩文件,解压为指定文件 [root@centos01 d6]# ls 1.cp.txt 1.txt 1.txt.gz

bzip2压缩工具

[root@centos01 d6]# bzip2 1.txt # 压缩1.txt [root@centos01 d6]# ls -l total 1840 -rw-r--r--. 1 root root 1361328 Sep 30 07:50 1.cp.txt -rw-r--r--. 1 root root 149229 Sep 30 07:38 1.txt.bz2 -rw-r--r--. 1 root root 365757 Sep 30 07:48 1.txt.gz [root@centos01 d6]# bzip2 -d 1.txt.bz2 # 解压缩1.txt.bz2 [root@centos01 d6]# ls 1.cp.txt 1.txt 1.txt.gz [root@centos01 d6]# bzip2 1.txt [root@centos01 d6]# bunzip2 1.txt.bz2 # 解压缩1.txt.bz2 [root@centos01 d6]# bzip2 -c 1.txt > 1.tmp.bz2 # 压缩时不删除文件,并输出到指定文件 [root@centos01 d6]# ls 1.cp.txt 1.tmp.bz2 1.txt 1.txt.gz [root@centos01 d6]# bzip2 -d -c 1.tmp.bz2 > 1.cp2.txt # 压缩时不删除文件,并输出到指定文件 [root@centos01 d6]# ls 1.cp2.txt 1.cp.txt 1.tmp.bz2 1.txt 1.txt.gz [root@centos01 d6]# bzip2 -9 1.cp.txt # -9级别,范围1-9 [root@centos01 d6]# ls 1.cp2.txt 1.cp.txt.bz2 1.tmp.bz2 1.txt 1.txt.gz [root@centos01 d6]# bzcat 1.tmp.bz2 | head -n 10 # bz2压缩文件查看 # This is an example configuration file for the LVM2 system. # It contains the default settings that would be used if there was no # /etc/lvm/lvm.conf file. # # Refer to 'man lvm.conf' for further information including the file layout. # # Refer to 'man lvm.conf' for information about how settings configured in # this file are combined with built-in values and command line options to # arrive at the final values used by LVM. #

xz压缩工具

[root@centos01 d6]# xz 2.txt [root@centos01 d6]# xz -d 2.txt.xz [root@centos01 d6]# xz 2.txt [root@centos01 d6]# unxz 2.txt.xz [root@centos01 d6]# xz -c 2.txt > 2.cp.txt.xz [root@centos01 d6]# xz -d -c 2.cp.txt.xz > 2.cp.txt [root@centos01 d6]# xz 2.txt [root@centos01 d6]# xzcat 2.txt.xz | head -n 10 # This is an example configuration file for the LVM2 system. # It contains the default settings that would be used if there was no # /etc/lvm/lvm.conf file. # # Refer to 'man lvm.conf' for further information including the file layout. # # Refer to 'man lvm.conf' for information about how settings configured in # this file are combined with built-in values and command line options to # arrive at the final values used by LVM. #

查看全文
大家还看了
也许喜欢
更多游戏

Copyright © 2024 妖气游戏网 www.17u1u.com All Rights Reserved