Linux Compression Tools

Posted: January 26, 2013 in Basic, LINUX

Linux Compression Tools

Posted on : 25-10-2011 | By : admin | In : Admin Tools

Tags:

0

There are two main compression utilities used in GNU/Linux. It’s normal to first “tar” a bunch of files (using the tar program of course) and then compress them with either bzip2 or gzip. Of course either of these tools could be used without tar, although they are not designed to work on more than one file (they use the UNIX tools philosophy, let tar group the files, they will do the compression…this simplifies their program). It’s normal to use tar and then use these tools on them, or use tar with the correct options to use these compression programs.

 

 

Linux Compression Tools

GNU zip (gzip)

zip is the GNU zip compression program and probably the most common compression format on UNIX−like operating systems.

  • # gzip your_tar_file.tar

This will compress a tar archive with GNU zip, usually with a .gz extension. Gzip can compress any type of file, it doesn’t have to be a tar archive.

  • # gunzip your_file.gz

This will decompress a gzipped file, and leave the contents in the current directory.

 

 

Linux Compression Toolsbzip2

 

 

 

bzip2 is a newer compression program taht offers superior compression to gzip at the cost of more processor time.

 

  • # bzip2 your_tar_file.tar

 

This will compress a tar archive with the bzip2 compression program, usually with a .bz extension. bzip2 can compress any type of file, it doesn’t have to be a tar archive.

 

  • # bunzip2 your_file.tar.bz2

 

This will decompress a file compressed by bzip2, and leave the contents in the current directory.

 

Linux Compression Toolszipinfo

 

 

 

Use zipinfo to find detailed information about a zip archive (the ones usually generally used by ms−dos and windows, for example winzip).

 

Command syntax:

 

  • # zipinfo zip_file.zip

 

 

Linux Compression Toolszipgrep

Will run grep to look for files within a zip file (ms−dos style, for example winzip) without manually decompressing the file first.

 

 

Command syntax:

  • # zipgrep pattern zip_file.zip

 

 

bzip2recover

 

Used to recover files from a damaged bzip2 archive. It simply extracts out all the working blocks as there own bzip2 archives, you can than use bzip2 −t on each file to test the integrity of them and extract the working files.

  • # bzip2recover filename

 

bzme

 

Will convert a file that is zipped or gzipped to a file compressed using bzip2.

Command syntax:

  • # bzme filename

 

Both gzip and bzip2 supply tools to work within compressed files for example listing the files within the archive, running less on them, using grep to find files within the archive et cetera. For gzip the commands are prefixed with z, zcat, zless, zgrep. For bzip2 the commands are prefixed with bz, bzcat, bzless, bzgrep.

 

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s