Print View

Creating Compressed Archives
Updated: 11/14/2004


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.

Requirements

  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.

Usage

# 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.


Author: Jon LaBass
jon at bsdguides dot org

Find this guide useful?
Support the author:


2 Comments

Posted by pj on December 05, 2005 at 11:06:37 am PST

Is there a way to do this with mulitple directories?

For example, an entire user directory under /home/username ?


Posted by pj on December 05, 2005 at 11:06:37 am PST

Never mind, I'm stupid!

I figured it out :)


Copyright 2003 - 2012 BSD Guides.  All rights reserved.

About | Terms of Use | Privacy | Contact