tar是什么格式

日期: 浏览:4

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

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

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

gzip压缩工具

  • 命令格式: 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]# ls1.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]# ls1.txt[root@centos01 d6]# gunzip 1.txt.gz # gunzip解压1.txt.gz[root@centos01 d6]# ls1.txt[root@centos01 d6]# gzip -1 1.txt # 默认压缩级别6,范围1-9 [root@centos01 d6]# ls1.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]# ls1.txt 1.txt.gz[root@centos01 d6]# gunzip -c 1.txt.gz > 1.cp.txt # 不删除压缩文件,解压为指定文件[root@centos01 d6]# ls1.cp.txt 1.txt 1.txt.gz

bzip2压缩工具

  • 安装工具: yum install -y bzip2
  • 命令格式: bzip2 文件名
  • 不支持压缩目录
[root@centos01 d6]# bzip2 1.txt # 压缩1.txt[root@centos01 d6]# ls -ltotal 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]# ls1.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]# ls1.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]# ls1.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]# ls1.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压缩工具

  • 命令格式: xz 2.txt
  • 使用基本和gzip、bzip2一样
[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.#
压缩工具gzip、bzip2、xz

推荐阅读
北京市社保比例的政策(北京市社保标准是多少)
深圳招商银行温州有吗(招商银行温州分行营业部)
用友财务软件哪些需要在总账里做(用友系统怎么启用总账)
尖头黑皮鞋休闲搭配(尖头黑皮鞋休闲搭配图)
安徽蚌埠社保退休政策(安徽省蚌埠市2021退休政策)
深市市值能申购科创板股票吗(深圳市值可以申购创业板)
乐富pos机信用卡套现(乐富刷卡)
为什么投资基金迅速发展(为什么投资基金迅速发展起来)
tar是什么格式文档下载: PDF DOC TXT