In continuation of our series of Linux tutorial,I am here presenting the gzip and gunzip command in Linux
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.
$ls alert_CHECK.log $gzip alert_CHECK.log $ ls alert_CHECK.log.gz $ls alert_CHECK.log.gz $gunzip alert_CHECK.log.gz $ ls alert_CHECK.log
The gzip command can be used with tar command also to gzip the tar files. Example is show below
tar gzip command
tar -cvf - file1 file2 | gzip > file.tar.gz

Similary gunzip command can be used with tar command also to unzip the tar files. Example is show below
tar guzip command
gunzip -c file.tar.gz|tar -xvf -

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
Also Read
Linux command for Oracle DBA
sed command in unix examples
basic unix command
loop in shell scripts
awk command in Unix
tr command in Unix
https://en.wikipedia.org/wiki/Bzip2
Leave a Reply