tar / gzip commands

Here, we are sending the tar file to -, which stands for tar’s standard output. This is piped to gzip, which compresses the incoming tar file, and the result is saved in backup.tar.gz. The -c option to gzip tells gzip to send its output to stdout, which is redirected to backup.tar.gz.

tar cvf - /etc | gzip -9c > backup.tar.gz

A single command used to unpack this archive would be:

gunzip -c backup.tar.gz tar xvf -

-or-

gunzip -c LDAPsetup.1.0.SPARC.SOL9.pkg.tar.gz | tar -xvf -

Create a tar file from list of files inside a text file

tar cfvz forhans.tar.gz `cat manifest.txt`

warning

if there are spaces in the file, you will have issues

Backup home directory

(cd /home/reese; tar cf - *) > reese-hostname.tar

Share