To compress and uncompress the files in unix you can use the following commands.
1. Compress and uncompress
2. gzip and gunzip
3. bzip2 and bunzip2
Compress and uncompress
The output file has the extension as .Z
Example:
$ compress -v test.txt
test.txt: Compression: 59.74% This file is replaced with test.txt.Z
To compress file to another directory
$ compress -c proddmp.dmp > /data_back/proddmp.dmp.Z
$ uncompress test.txt.Z
$
To uncompress to another directory
$ uncompress -c proddmp.dmp.Z > /oradump/proddmp.dmp
gzip and gunzip
The output file has the extension as .gz
Example:
$ gzip test.txt
test.txt.gz
$ gunzip test.txt.gz
note: You can use gzip -d instead of gunzip. Both are same.
To view the compressed text file without decompressing use gzcat or gzmore if available in the platform.
$ gzcat test.txt.gz
$ gzmore test.txt.gz
To compress the folder
$ gzip -r /oracle/test
$ gunzip -r /oracle/test
bzip2 and bunzip2
The output file has the extension .bz2 The usage of bzip2 and bunzip2 is similar to gzip and gunzip.
Thanks
Sunday, September 13, 2009
Subscribe to:
Posts (Atom)