The tar program is used to archive and unarchive files. It does not support compression directly, but the -j (bzip2) and -z (gzip) options will typically compress the archive file it creates. It is used to accumulate a large collection of files into a single archive file (packer), while preserving filesystem information such as user and group permissions, dates, and directory structures.
Example, to pack the /home/usuary directory, excluding /home/usuary/desktop in the file usuary.tar, type in a terminal:
tar cvf usuary.tar --exclude=/home/usuary/desktop /home/usuary
Using the tape archiver for backups
Laser Servo Diskettes
Excluding a directory from a tar backup
To tell the tar tape archiver to skip backup of a directory, the --exclude switch may be used. Suppose that we are backing up the foobar directory, and we want to exclude the directories foo and bar from our backup:
- tar cvf foobar.tar --exclude foobar/foo --exclude foobar/bar ./foobar
Wildcards are not allowed in the exclude parameters
Skip backup of files that you do not have permission to read
The tape archiver provides an ignore-failed-read switch that is used to tell the tape archiver to skip backup of files that it does not have permission to read.