tar is a tool for archiving and extracting archive files in this format.
The archive files generated with this application in case of compression of a directory containing other directories and files, a directory tree, which allows you to restore it after unpacking.

Syntax:

tar -options archive files

Options:
c – creates a new archive
x – unzips the file
t – displays the contents of the archive file
z – compresses the archive using gzip
r – appends files to an existing archive
f – specifies the file where to save the archive

Examples of use:
To create an archive file named yourarchive.tgz containing all files and subdirectories from the /yourdomain.com directory, type:

tar -c -z -f yourarchive.tgz /yourdomain.com

Commands for archiving files:
To extract the compressed archive named yourrchive.tgz to the current directory, type:

tar -x -z -f yourarchive.tgz

To append an additional.txt file to the existing, uncompressed archive named yourarchive.tar , type:

tar -r -f yourarchive.tar additional.txt
Author

I’m Michael , a tech geek. Join me on the journey through interwebs to find latest news, tips and hints.

Write A Comment