Creating Compressed Archives

General Information

You’ve downloaded them, you’ve extracted them, you’ve liked them. But how do you create them? This guide will show you how to quickly and easily create a compressed archive in the form of *.tar.gz and *.tar.bz2.


  1. Local access on the box.
  2. A SSH client such as puTTy or SecureCRT (if you are setting it up remotely).
  3. Files you want to archive.


# tar -cvf archive.tar file

The -c flag tells tar to create a new archive. The -v flag tells tar to display the results while tarring. The -f flag tells tar to create a file named archive.tar. You can either tar directories or files specificied by file. You can enter several files/directories separated by spaces if you want.

There are two common methods of compression:

# tar -cvzf archive.tar.gz file
# tar -cvjf archive.tar.bz2 file

The -z flag indicates to run the archive through gzip while the -j runs the archive through bzip2.

That’s all there is to making your compressed archives.

Speak Your Mind