Sunday, March 22, 2009

Gzip to a different directory

There are times that you have to extract files to a different directory since if you extract it in the current directory you'll end up with the filesystem full.

Here's how to do a gzip to a diffrent directory:

Compress the files to an alternate (larger) file system using gzip's --to-stdout (-c) and shell
redirection, remove the original file, and move the compressed file to the original location.


To show it more clearly here's an example:

# pwd/var/adm

# ls -l wtmpx.OLD -rw-r--r-- 1 root other 591931980 Aug 6 10:30 wtmpx.OLD

# df -k /varFilesystem kbytes used avail capacity Mounted on/dev/md/dsk/d3 1016122 869649 85506 96% /var

# df -k /files0Filesystem kbytes used avail capacity Mounted on/dev/md/dsk/d5 31387621 2365849 28707896 8% /files0

# gzip --best --to-stdout wtmpx.OLD > /files0/wtmpx.OLD.gz# rm wtmpx.OLD# mv /files0/wtmpx.OLD.gz .

Readers who read this page, also read:




Bookmark and Share My Zimbio http://www.wikio.com

0 comments: