Notes on how to use tar

Notes on how to use tar

Postby stephen » Sun Dec 14, 2008 6:10 am

How to tar
linux tar
howto tar
Listing the Contents of a Tar File


Where file.tar is the name of your tar file.

If you just want a simple list, use the command:

tar -tf file.tar

How to Extract Files from a Tar File

If you want to extract one or a few files from a tar file, use a command similar to the following:

tar -xvf file.tar filenames

Extract from a compressed file
tar -xzvf file.gz filenames

to compress
tar -czf file.tar.gz filenames

eg to create a compressed tar of all files in current directory that end in .sh and a files called check-email
tar -czf scripts.tar.gz *.sh check_email

to look at the contents of the file created above
tar -tzf scripts.tar.gz

A sample full incremental script can be found here
http://bash.cyberciti.biz/backup/tar-full-incremental-tape-backup-script/


This script performs a daily files backup
http://forum.softpedia.com/index.php?showtopic=392359
stephen
 
Posts: 507
Joined: Thu Feb 09, 2006 9:37 am
Location: Brisbane

Return to Linux Server Configuration Notes

Who is online

Users browsing this forum: No registered users and 1 guest

cron