how to use tar command

how to use tar command

Postby stephen » Tue Jan 06, 2009 6:45 am

This is the GNU Tar manual
http://www.gnu.org/software/tar/manual/html_node/tar.html#SEC_Top

This is a command I use to create an archive
eg
Code: Select all
cd /etc
tar -zcpf /home/user/move/etc_mail.tar.gz mail

the parameters used in tar line above
-z means use compression
c means create an archive
p means Normally when creating an archive, tar strips an initial ‘/’ from member names. This option disables that behavior.
f /home/user/move/etc_mail.tar.gz means the tar archive is stored in a file etc_mail.tar.gz located in /home/user/move directory
the last parameter mail means that the operation will occur on the mail directory and all files and directories below

This is the command I use to extract the contents of the archive
Code: Select all
tar -zxpf etc_mail.tar.gz


This is the command to list the contents of the archive
Code: Select all
tar -ztf etc_mail.tar.gz
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 2 guests

cron