Linux compress command
Linux Command大全
The Linux compress command is a relatively old Unix file compression command. The compressed files will be added with a .Z extension name to distinguish them from uncompressed files. The compressed files can be decompressed with uncompress. To compress multiple files into a single compressed archive, the files must be archived with tar first and then compressed. Since gzip can produce a more ideal compression ratio, most people have already switched to gzip as the file compression tool.
Syntax
compress [-dfvcV]-b maxbits] [file ...]
Parameters:
- c Output the result to the standard output device (usually the screen)
- f Force writing to the file, if the target file already exists, it will be overwritten (force)
- v Print program execution messages to the screen (verbose)
- b Set the upper limit of the number of common strings, in bits, the values that can be set are 9 to 16 bits. Since the higher the value, the more common strings that can be used, the higher the compression ratio, so the default value is generally used 16 bits (bits)
- d Decompress the compressed archive
- V List version information
- Example:
- Compress source.dat into source.dat.Z, if source.dat.Z already exists, its content will be overwritten by the compressed archive.
- compress -f source.dat
- Compress source.dat into source.dat.Z and print the compression ratio.
- -v and -f can be used together with
- compress -vf source.dat
- Output the compressed data after compression and import it into target.dat.Z to change the name of the compressed file.
- compress -c source.dat > target.dat.Z
- -The larger the value of b, the higher the compression ratio, ranging from 9-16 , the default value is 16 .
- compress -b 12 source.dat
- To unzip source.dat.Z into source.dat, if the file already exists, the user must press y to confirm overwriting the file, if using -The df program will automatically overwrite the archive. Since the system will automatically add .Z as the extension name, source.dat will be automatically treated as source.dat.Z.
- compress -d source.dat
- compress -d source.dat.Z
Online Examples
Compress File
[[email protected] ~]# compress abc.h
[[email protected] ~]# ls
abc.h.Z
Unzip File
[[email protected] ~]# compress -d abc.h.Z
[[email protected] ~]# ls
abc.h.
Compress according to the specified compression ratio
[[email protected] ~]# compress -b 7 abc.h
Force Compress Folder
[[email protected] ~]# compress -rf /home/abc/
Linux Command大全