Friday, December 5, 2014

Archiving with Tar


Tar files place several files or the contents of a directory or directories in one file


tar -cvf filename.tar files/directories

To list the contents of a tar file, type: 

#tar -tvf test.tar


To extract the contents of a tar file, type:  

#tar -xvf test.tar


The tar command does not compress files automatically. 

You can compress tar files with:

#tar -czvf test.tar


Compressed tar files are conventionally given the extension .tgz and are compressed with gzip.
To expand a compressed tar file type:

#tar -xzvf test.tgz


No comments:

Post a Comment