how to use tar command

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
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
This is the command to list the contents of the archive
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