tar: Tape Archive Files
by Tammy Fox
Last Modified: Wednesday, 19-May-2004 11:55:38 EDT
|
Introduction
|
    TAR stands for Tape ARchive. It was originally designed for tape backups. Hence, the word tape in the name. It can now be used to create a tar file anywhere on the filesystem. TAR creates one "tar file" out of several files and directories keeping the absolute paths if wanted. It is important to know that it does not compress the files in any way. Thus, the TAR file will take up the same amount of space as all the individual files combined. A TAR file can be compressed by using gzip or bzip2.
|
|
Basic TAR Syntax
|
    The syntax for TAR is as follows:
tar -switches tarfile.tar where tarfile.tar is the name of the tar file.
Commonly Used TAR Switches
| Switch |
Explanation |
| x |
Extract the contents of the TAR file |
| c |
Create a TAR file |
z |
Gunzip(uncompress) it before extracting, used on file ending in .tar.gz or .tgz |
| v |
Verbose - display contents as it is tarring or extracting |
| f |
Filename to follow |
| t |
List contents of TAR file |
|
|
Examples
|
| Example |
Explanation |
tar -xvf example.tar |
Extract the contents of example.tar and display the files as they are extracted |
tar -cf backup.tar /home/ftp/pub |
Create a TAR file named backup.tar from the contents of the directory /home/ftp/pub |
tar -zxvf example.tgz |
Gunzip(uncompress) example.tgz and then extract the contents displaying the files as they are extracted |
tar -tvf example.tar |
List contents of example.tar to the screen |
|
|
What's Related
|
|
|
|
|
|
|
All Rights Reserved Linux Headquarters © 2000-2007
Linux is a registered trademark of Linus Torvalds
All logos are registered trademarks of their respective owners
Last modified: Wednesday, May 19, 2004
|
|
|