Wednesday, January 5, 2011

compress, uncompress, pack, unpack, zcat

Utilities to compress or expand data. The compress command reduces the size of the named file(s) and renames it with a .Z extension. Compressed files can be restored to their original form using the uncompress command. This utility appears to have a more EFFICENT packing scheme than the PACK/UNPACK commands.


Examples What it does
compress -v /tmp/junk File /tmp/junk is compressed and gets renamed to /tmp/junk.Z. -v displays the percentage of file shrinkage
uncompress /tmp/junk.Z Restores file to original file type and file size and changes the name to /tmp/junk.


1)find . -print | backup -ivqpf /tmp/roger.bck
2) compress /tmp/roger.bck
3) find /tmp/roger.bck.Z -print | backup -ivqf/dev/fd0 The 3 commands will backup the current directory and compress that backup image to a floppy diskette.


1) restore -xvf/dev/fd0
2) uncompress < /tmp/roger.Z | restore -xvf- Restore the files archived from a floppy diskette. (In this example assume restored file=roger.Z) Uncompress the compressed image and restore this file back to the file system zcat /tmp/junk.Z > /tmp/junk1 Uncompresses /tmp/junk.Z into /tmp/junk1

find /u/COMPANY -print | xargs pack -f Packs all the files under the specified directory (/u/COMPANY)
find /u/COMPANY -print | xargs unpack Unpacks all the files under the specified directory (u/COMPANY)

No comments:

Post a Comment