日期:2014-05-16 浏览次数:20746 次
本文链接: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 ~]#
[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>