Tar & tar.gz

From PCLinuxOSHelp Knowledge Base
Jump to: navigation, search

Create and Extract tar.gz File

The tar program provides the ability to create tar archives, as well as various other kinds of manipulation. Initially, tar archives were used to store files conveniently on magnetic tape. The name “Tar” comes from this use; it stands for tape archiver. To create tar.gz archive

Example:

tar cvzf /path/to/store/your/filename.tar.gz  /path/to/folder/or/filename
  Where,
      c = create
      v = verbose
      z = zipped format
      f = File name and where to store Archive

Extracting a Tar Archive

Example:

tar xvzf /pat/to/filename.tar.gz
 Where,
     x = extract
     v = verbose  
     z = filter the archive through gzip
     f = use archive file

The tar command can also be used to uncompress bzip2 files, using the -j switch. For more information about the tar see the man pages.