`

我使用过的Linux命令之uncompress - 解压.Z文件

阅读更多

我使用过的Linux命令之uncompress - 解压.Z文件

本文链接:http://codingstandards.iteye.com/blog/790830    (转载请注明出处)

用途说明

compress命令是用来将文件压缩成.Z格式的,对应的uncompress是用来解压的。Compress  reduces  the size of the named files using adaptive Lempel-Ziv coding.  Whenever possible, each file is replaced by one with the extension .Z, while keeping the same ownership modes, access and modification  times.

这个命令使用的算法因为不够先进,在Linux下现在都采用gzip和gunzip来压缩和解压了。但是很多老的压缩文件可能是.z格式的,因此需要用到它。一般情况下,安装好的Linux系统下可能没有这个命令,那么就需要到安装盘中找到包含ncompress字符串的rpm包来进行安装。这也是网上很多人问“在LINUX 中没有COMPRESS这个命令”或“为什么linux中的compress不能用”的原因了。

常用参数

因为compress和uncompress并不常用,因此参数并不太重要了,在需要时man一下就清楚了。

使用示例

示例一 压缩文件

[root@localhost ~]# ls -l install.log
-rw-r--r--  1 root root 48038 10月  8 17:18 install.log
[root@localhost ~]# compress install.log
[root@localhost ~]# ls -l install.log install.log.Z
ls: install.log: 没有那个文件或目录
-rw-r--r--  1 root root 17034 10月  8 17:18 install.log.Z
[root@localhost ~]#

示例二 解压.Z文件

[root@localhost ss7linux]# uncompress dpklnx6.Z 

-bash: uncompress: command not found

 

[root@localhost ss7linux]# cd /software/

[root@localhost software]# ls

disc1  disc2  disc3  disc4  ss7

[root@localhost software]# find . -name "ncompress*"

./disc4/RedHat/RPMS/ncompress-4.2.4-40.i386.rpm

[root@localhost software]# rpm -ivh ./disc4/RedHat/RPMS/ncompress-4.2.4-40.i386.rpm

warning: ./disc4/RedHat/RPMS/ncompress-4.2.4-40.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e

Preparing...                ########################################### [100%]

   1:ncompress              ########################################### [100%]

[root@localhost software]# cd /root/setup/ss7linux/

[root@localhost ss7linux]# uncompress dpklnx6.Z 

<!-- [if gte mso 9]><xml><w:WordDocument><w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel><w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery><w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery><w:DocumentKind>DocumentNotSpecified</w:DocumentKind><w:DrawingGridVerticalSpacing>7.8</w:DrawingGridVerticalSpacing><w:View>Normal</w:View><w:Compatibility></w:Compatibility><w:Zoom>0</w:Zoom></w:WordDocument></xml><![endif]-->

[root@localhost ss7linux]# ls

dpklnx6

 

示例三 在CentOS4.8下安装ncompress

CentOS4.8的ncompress包在第四章光盘中。

[root@localhost media]# pwd
/media

[root@localhost media]# mount /dev/cdrom
mount: block device /dev/hdc is write-protected, mounting read-only
[root@localhost media]# cd cdrom/
[root@localhost cdrom]# find . -name "ncompress*.rpm"
./CentOS/RPMS/ncompress-4.2.4-44.rhel4.i386.rpm
[root@localhost cdrom]# rpm -ivh ./CentOS/RPMS/ncompress-4.2.4-44.rhel4.i386.rpm
警告:./CentOS/RPMS/ncompress-4.2.4-44.rhel4.i386.rpm: V3 DSA 簽章:NOKEY, key ID 443e1821
準備中...                   ########################################### [100%]
   1:ncompress              ########################################### [100%]
[root@localhost cdrom]# cd ..
[root@localhost media]# umount /dev/cdrom

问题思考

1. compress和uncompress使用的压缩算法的大体原理如何?

2. 是比较各种压缩工具(compress、gzip、bzip2、tar、rar等)的效率、压缩比率?

相关资料

【1】中国IT实验室 Linux 指令篇:编码压缩打包--compress

【2】鳥哥的 Linux 私房菜  第九章、檔案與檔案系統的壓縮與打包

 

返回 我使用过的Linux命令系列总目录

 

0
0
分享到:
评论

相关推荐

    jdk-8u181-linux-i586.tar.gz 64位

    官网下载的tar.gz包,亲测可用! tar -c: 建立压缩档案 -x:解压 -t:查看内容 -r:向压缩归档文件末尾追加...6、*.Z 用 uncompress 解压 7、*.tar.Z 用tar –xZf 解压 8、*.rar 用 unrar e解压 9、*.zip 用 unzip 解压

    Linux下tar.bz2的解压文件命令

    linux下怎么解后缀名是gzip的文件?  1.以.a为扩展名的文件:  #tar xv file.a  2.以.z为扩展名的文件:  #uncompress file.Z  3.以.gz为扩展名的文件:  #gunzip file.gz  4.以.bz2为扩展名的文件:  #...

    linux tar命令详解

    我们已介绍过linux下的tar、gzip、gunzip、bzip2、bunzip2、compress、uncompress、 zip、unzip、rar、unrar等程式,你应该已能够使用他们对.tar、.gz、.tar.gz、.tgz、.bz2、.tar.bz2、.Z、.tar.Z、.zip、.rar这10...

    liunx网卡驱动下载

    linux下怎么解后缀名是gzip的文件? 1.以.a为扩展名的文件: #tar xv file.a 2.以.z为扩展名的文件: #uncompress file.Z 3.以.gz为扩展名的文件: #gunzip file.gz 4.以.bz2为扩展名的文件: #bunzip2 file.bz2...

    linux常用解压方式

    linux常用解压方式:1、*.tar 用 tar –xvf 解压 2、*.gz 用 gzip -d或者gunzip 解压 3、*.tar.gz和*.tgz 用 tar –xzf 解压 4、*.bz2 用 bzip2 -d或者用bunzip2 解压 5、*.tar.bz2用tar –xjf 解压 6、*.Z 用 ...

    uncompress 命令包,ncompress rpm包

    32位 X86 linux下安装包,用于支持.Z文件的解压等操作。

    Linux下文件的各种打包与压缩文件后缀及其解包解压缩方法

    简要的介绍了linux下的tar、gzip、gunzip、bzip2、bunzip2、compress、uncompress、 zip、unzip、rar、unrar等压缩程序,使用它们对.tar、.gz、.tar.gz、.tgz、.bz2、.tar.bz2、.Z、.tar.Z、 .zip、.rar这10种压缩...

    Linux:linux下解压tar.xz、tar、tar.gz等文件方法

    Linux:linux下解压tar.xz、tar、tar.gz等文件方法 1、tar语法 tar(选项)(参数) 选项: -A或–catenate:新增文件到以存在的备份文件; -B:设置区块大小; -c或–create:建立新的备份文件; -C :这个选项用在解...

    Linux操作系统下解压文件的技巧

    本文介绍了linux下的压缩程式tar、gzip、gunzip、bzip2、bunzip2、compress、uncompress、zip、 unzip、rar、unrar等程式,以及如何使用它们对.tar、.gz、.tar.gz、.tgz、.bz2、.tar.bz2、.Z、. tar.Z、.zip、.rar这...

    Linux下的压缩解压缩命令详解

    本文介绍了linux下的压缩程式tar、gzip、gunzip、bzip2、bunzip2、 compress、uncompress、zip、unzip、rar、unrar等程式,以及如何使用它们对.tar、.gz、.tar.gz、. tgz、.bz2、.tar.bz2、.Z、.tar.Z、.zip、.rar这...

    兼容、适配QT的压缩 qCompress 和 解压 qUncompress 函数

    这是为了适配QT压缩 qCompress 和 解压 qUncompress 函数而修改的文件, * 本代码中的 zCompress 函数对应QT的 qCompress; * 本代码中的 zUncompress 函数对应QT的 qUncompress; * QT的 QByteArray 用 ZByteArray...

    Linux compress命令用法详解

    Linux compress命令是一个相当古老的 unix 档案压缩指令,压缩后的档案会加上一个 .Z 延伸档名以区别未压缩的档案,压缩后的档案可以以 uncompress 解压。若要将数个档案压成一个压缩档,必须先将档案 tar 起来再...

    Linux 简单指令下载

    经过tar打包后,也可用compress命令压缩(注:gzip比compress压缩更加有效),产生一个以.tar.Z的文件,在解包时,可先用“uncompress 文件名”格式解压,然后用“tar -xvf 文件名”解包。也可直接调用“tar -Zxvf ...

    32位 compress/ncompress for linux (亲测64位操作系统也可以用)

    Linux compress命令是一个相当古老的 unix 档案压缩指令,压缩后的档案会加上一个 .Z 延伸档名以区别未压缩的档案,压缩后的档案可以以 uncompress 解压。若要将数个档案压成一个压缩档,必须先将档案 tar 起来再...

Global site tag (gtag.js) - Google Analytics