In continuation of our series of Unix tutorial,I am here presenting the Unix Tutorial: Compress,Uncompress command,gzip and gunzip command
compress – The compress utility will attempt to reduce the size of the named files. File will be replaced by one with the extension .Z, while keeping the same ownership modes, change times and modification times.
uncompress – The uncompress utility will restore files to their original state after they have been compressed using the compress utility.
compress [ -fv ] [ file … ]
uncompress [ -cfv ] [ file … ]
zcat [ file … ]
-c Write to the standard output. No files are changed.
-f When compressing, force compression of file, even if it does not actually reduce the size of the file, or if the corresponding file.Z file already exists.
-v Verbose. Write to standard error messages concerning the percentage reduction or expansion of each file.
gzip and gunzip command
gzip : The gzip utility will attempt to reduce the size of the named files. File will be replaced by one with the extension .gz, while keeping the same ownership modes, change times and modification times.
gunzip: The gunzip utility will restore files to their original state after they have been compressed using the gzip utility.
Difference between gzip and compress
Both the utlity compress and gzip compress the file i.e serve the same purpose
1) In general Compress will run faster and use less memory, but gzip will generally reach significantly higher levels of compression.
2) Compress is a old algorithm while gzip is the new one
Fews things to note
1) when compress or uncompress we should have the disk space to hold both the compress and uncompress copy
2) if it fails,it get revert back to original status