Home > Computing, Linux > Compressing and decompressing commands in the linux shell

Compressing and decompressing commands in the linux shell

November 26th, 2008 Leave a comment Go to comments

Here are a few of the compress and decompress commands available for linux in the shell. I always tend to forget all those parameters. So it’s good to have a quick reference for these commands instead of having to look at the man pages every time.

You can use the extra parameter “v” with all commands with the tar executable. This turns on verbose mode so tar will output what it is doing to stdout.

Wikipedia is a good place to start if you want to know how data compression works. Howstuffworks also has an article about data compression

.tar
Decompress: tar xf [filename].tar
Compress: tar cf [filename].tar [dirname]

.gz
Decompress1: gunzip [filename].gz
Decompress2: gzip -d [filename].gz
Compress: gzip [filename]

.tar.gz
Decompress: tar zxf [filename].tar.gz
Compress: tar zcf [filename].tar.gz [dirname/filename]

.bz2
Decompress1: bzip2 -d [filename].bz2
Decompress2: bunzip2 [filename].bz2
Compress: bzip2 -z [filename]

.tar.bz2
Decompress: tar jxf [filename].tar.bz2
Compress: tar jcf [filename].tar.bz2 [dirname]

.bz
Decompress1: bzip2 -d [filename].bz
Decompress2: bunzip2 [filename].bz

.tar.bz
Decompress: tar jxf [filename].tar.bz

.Z
Decompress: uncompress [filename].Z
Compresscompress [filename]

.tar.z
Decompress: tar Zxf [filename].tar.z
Compress: tar Zcf [filename].tar.z [dirname]

.tgz
Decompress: tar zxf [filename].tgz

.tar.tgz
Decompress: tar zxf [filename].tar.tgz
Compress: tar zcf [filename].tar.tgz [filename]

.zip
Decompress: unzip [filename].zip
Compress: zip [filename].zip  [filenames] (*)

  1. No comments yet.
  1. No trackbacks yet.