Latest web development tutorials

Linux compress command

Linux command Daquan Linux command Daquan

Linux compress command is a very old unix command file compression, compressed files .Z extension will add a file name to distinguish between uncompressed files, compressed files can uncompress decompress. To several files compressed into a zip file, you must first file tar up recompression. Since gzip can produce better compression ratio, more than most people have switched to gzip file compression tool.

grammar

compress [-dfvcV] [-b maxbits] [file ...]

Parameters:

  • c output to the standard output device (usually the screen)
  • f forced write to the file, if the destination file already exists, it will be overwritten (force)
  • v The message printed program execution on the screen (verbose)
  • b capping the number of common string calculated in bytes, you can set the value of 9 Zhi 16 bits. Since the higher the value, the string can be used together, the more, the greater the compression ratio, it is generally use the default value of 16 bits (bits)
  • d will unzip the zip file
  • V lists the version Message
  • Example:
  • Source.dat compressed into source.dat.Z, if source.dat.Z already exists, the contents of the archive will be overwritten.
  • compress -f source.dat
  • Source.dat compressed into source.dat.Z, and print out the compression ratio.
  • can be used together with the -f -v
  • compress -vf source.dat
  • The compressed data output, then import target.dat.Z can change the compression file name.
  • compress -c source.dat> target.dat.Z
  • The greater the value -b, the greater the compression ratio, the range is 9-16, default is 16.
  • compress -b 12 source.dat
  • The source.dat.Z decompression into source.dat, if the file already exists, the user press y to determine the coverage file, if used -df program will automatically overwrite the file. Because the system is automatically added as an extension .Z file name, so as source.dat.Z source.dat automatically processed.
  • compress -d source.dat
  • compress -d source.dat.Z

Compressed file

[[email protected] ~]# compress abc.h
[[email protected] ~]# ls

abc.h.Z

unzip files

[[email protected] ~]# compress -d abc.h.Z
[[email protected] ~]# ls

abc.h.

Specified compression ratio compression

[[email protected] ~]# compress -b 7 abc.h

Forced Compressed Folders

[[email protected] ~]# compress -rf /home/abc/ 

Linux command Daquan Linux command Daquan