Archiving combines several files into one file. While compressing combines several files into a smaller file. Key difference being that a compressed file is stored in a smaller file.

Why is compressing a file useful? It helps package up many files into one file. This can save space and helps when sending files from one person to another. I use it all the time when sending server logs, error logs, system logs and more.

Tar – “GNU Tar saves many files together into a single tape or disk archive, and can restore individual files from the archive.”


#  tar {option} {file}

# tar -xf test.tar


This will extract all files from the .tar file into the same directory.  Extracting the files from an archive into a different directory would look like this.

# tar {option} {file}  {option} /destination/directory 

# tar -xf test.tar -C /tmp/data

tar 2

Here is the break down for the options that are commonly used with tar.

-x = Extract files from an archive.

-v = verbose mode, will feed you more information.

-f = specifies that it is a file

-C = change to a directory before preforming any operations. In a nutshell, this will extract the ie location that the user specifies.

For more information, view the man page  or type “tar –help” into your command line.


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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