Examples of compressing files

To compress a single file:

   ls -l sect5.fm
   -rw-------  1 erpl08      67584 Sep 30  1992 sect5.fm

   compress sect5.fm
   ls -l *.Z
   -rw-------  1 erpl08      33950 Sep 30  1992 sect5.fm.Z

The command ls -l shows the size of the file sect5.fm to be 67584 bytes before compression and 33950 bytes with compression - reducing the size of the file by 50%.


To compress several files:

   compress sect[1-8].fm

This compresses files sect1.fm through sect8.fm.


To recover compressed files:

   uncompress sect[1-4].fm.Z

This will decompress the compressed files sect1.fm.Z through sect4.fm.Z.


To recover a file and retain the compressed .Z file:

   zcat presentation.html.Z | less

This recreates the uncompressed file presentation.html which is then piped into the less command to present the file for viewing. The output from the zcat command could also be redirected to a file:

   zcat bibliography.txt.Z > bib.txt; vi bib.txt

This redirects the output from the zcat command to a file named bib.txt which is then displayed using the editor vi.


[Home] [Search] [Index] This site maintained by webmaster@softlab.ece.ntua.gr