How to use tar


Template level External Article ID

KBA00022106

Issue

Common usage of the tar command.

Resolution

The Unix command tar is short for tape archiving. It does a whole lot more than creating a nice package for archiving files to tape. It is a lot more common to use it to combine several files into one package to facilitate easier distribution. The package is often called a tar ball. The tar file is not compressed. Alternatively, you can use gtar to compress and archive files.

The instructions below will show the usage and then display an example on how the command is used:

  • View the contents of a tar file

    tar -tf [FILENAME]

    tar1.png

     
  • Create a tar file

    tar -cvf [FILENAME] [FILES SEPARATED BY SPACES]

    tar2.png

     
  • Extract files from a tar file

    tar -xvf [FILENAME]

    tar3.png
    tar4.png