Compress data files using Lempress-Ziv encoding
compress command Compress data files using "Lempress-Ziv" encoding. Compress is a compression program with a long history. After a file is compressed by it, a ".Z" extension will appear after its name. When decompressing, execute the uncompress command. In fact, uncompress is a symbolic link to compress, so whether compression or decompression can be completed separately through the compress command.
compress(option)(parameter)
-f: Do not prompt the user and force the target file to be overwritten;
-c: Send the results to standard output, no files are changed;
-r: recursive operation mode;
-b<Compression efficiency>: The compression efficiency is a value between 9 and 16. The default value is "16". The larger the value specified, the higher the compression efficiency;
-d: Decompress the file instead of compressing it;
-v: Display the instruction execution process;
-V: Display the command version and program default value.
Files: Specify a list of files to compress.
Copy /etc/man.config
to /tmp
and compress it
[root@localhost ~]# cd /tmp
[root@localhost tmp]# cp /etc/man.config .
[root@localhost tmp]# compress man.config
[root@localhost tmp]# ls -l
-rw-r--r-- 1 root root 2605 Jul 27 11:43 man.config.Z
Unzip the compressed file just now
[root@localhost tmp]# compress -d man.config.Z
Compress man.config into another file for backup
[root@localhost tmp]# compress -c man.config > man.config.back.Z
[root@localhost tmp]#ll man.config*
-rw-r--r-- 1 root root 4506 Jul 27 11:43 man.config
-rw-r--r-- 1 root root 2605 Jul 27 11:46 man.config.back.Z
This -c
option is more interesting! The data of the compression process will be output to the screen instead of being written into a file.Z file. Therefore, we can output the data into another file name through data flow redirection.