Linux uncompress --解压.Z文件

用途说明

compress命令是用来将文件压缩成.Z格式的,对应的uncompress是用来解压的。Compress reduces  the size of the named files using adaptive Lempel-Zivcoding.  Whenever possible, each file is replaced by one with theextension .Z, while keeping the same ownership modes, access andmodification  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 mso9]><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@localhostmedia]# pwd

/media

[root@localhostmedia]# mount /dev/cdrom

mount: block device/dev/hdc is write-protected, mounting read-only

[root@localhostmedia]# cd cdrom/

[root@localhostcdrom]# find . -name "ncompress*.rpm"

./CentOS/RPMS/ncompress-4.2.4-44.rhel4.i386.rpm

[root@localhostcdrom]# 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@localhostcdrom]# cd ..

[root@localhostmedia]# umount /dev/cdrom

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值