Using Tar

Tar is format of choice for archiving and compressing files on linux. It’s pretty simple.

Creating a Tarball

tar -czvf test.tar.gz test

tar -cjvf test.tar.bz2 test

Unpacking a Tarball

tar -xzvf test.tar.gz

tar -xjvf test.tar.bz2

  • c = create
  • z = gzip
  • j = bzip2
  • v = verbose
  • f = file
  • x = extract

You notice I give two different options, the difference is czvf vs cjvf, which is just the compression method. I usually use gzip, but both are pretty close to each other. From what I’ve heard bzip2 will give you better compression (about 15%) but is a little slower at compressing and decompressing.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s