Tar

From LXF Wiki

Tape archives (TARs) have been around for years, and whilst it is still an important format for Linux, is identical in layout to the original tape based backups, still used by businesses throughout the world today. Using the tar executable on Linux, it is possible to store an unlimited number of files in a single (verbose!) file. The obvious next step is then to apply compression (see gzip or bzip2), and you have a very useful backup tool.

Creating a tar file is simple, just use the template:

 $ tar -cf output.tar file_1 file_2 ...
 $ tar -cvf output.tar directory_1

To recover the original files or directories use:

 $ tar -xf output.tar

Adding Gzip or Bzip2 compression to creation (in BSD based Linux only) gives:

 $ tar -cjf output.tbz2 file_1 file_2 ...     # Bzip2 compression
 $ tar -czf output.tgz file_1 file_2 ...      # Gzip compression

To decompress them, simply type:

 $ tar -xjf output.tbz2                       # Bzip2 uncompression
 $ tar -xzf output.tgz                        # Gzip uncompression

Simple!