file compression

There are 2 commands to zip the files in unix

  1. compress
  2. pack

Compress: Syntax – $compress filename

The result of the above command is filename.Z

$compress -v filename

The optional -v (for verbose) option files compress to report how much space it saved. For example, in the above case it is it reported the following:

filename:compressed:70,50%-replaced with filename.Z


to get the compresses the back to its original state. Uncompress utility can be used as shown below.

$Uncompress filename.Z

filename.Z will be deleted and the original sample is recreated back in its original form and shape.

Once the file is compressed we can not view it using the original cat command. Unix provides Zcat for this purpose.

$Zcat filename.Z : It displays file contents in readable format.



It is also be able to compact a file. The compress offers a higher degree of compression as compared to pack.

  • Systax: $pack filename

eg: $pack filename

filename: 40% compression is smaller, the packed contents are stored in the file filename.Z and the original file filename is deleted.

To view the contents of a packed file we can use the pcat command

Spcat filename.Z

Related Posts

You can leave a response, or trackback from your own site.

Leave a Reply

Powered by k2schools
%d bloggers like this: