Basic usage of tar command

The basic usage is:

To create a non-compressed archive file:

tar -cvvf [filename.tar] [what to compress]

To create a gzipped archive (compressed):

tar -zcvvf [filename.tar.gz] [what to compress]

.tar.gz is often abbreviated as .tgz

To create a bzipped archive (compressed, even smaller):

tar -zcvvf [filename.tar.bz2] [what to compress]

.tar.bz2 is often abbreviated as .tbz2

An non compressed tar file can be converted to a .tar.bz2 by:

bzip2 [filename.tar]

It creates a file filename.tar.bz2 in the same folder


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.