|tar||GNU tar has plenty of features; some people would say "too many." I don't agree. GNU tar has features I wish I'd had for years in more "standard" versions. This article lists my favorites. For a complete list, check the documentation on the CD-ROM.|
Article 19.5 describes how to compress an archive file you've created. If you're using GNU tar, this is even easier, since tar itself can do the compression. Simply use the z option when writing or reading archives. For example, to make the gzipped tar archive progs.tar.gz from all ".c" and ".h" files:
tar cvzf progs.tar.gz *.c *.h
Compressed tape archives aren't recommended because error recovery can be difficult.
I've made the classic mistake of archiving files with their absolute pathnames (20.10). GNU tar saves you from that goof. It always stores absolute pathnames as relative paths unless you add the --absolute-names option.
Often I want to make a tape backup of my most recent work on a big project, but not all the thousands of files in a directory tree. The clumsy way to do that is by using find -mtime to make an include-file for the standard tar -I option. GNU tar to the rescue: its --after-date option lets me tell it what directories to look in and how recently the files should have been changed.
When I extract an archive, I may be writing into a directory that has other files. The --keep-old-files option tells GNU tar not to overwrite existing files.
One caution about GNU tar: it creates ANSI-format tar archives. Extracting one of these archives with the old V7 tar can cause warning messages like "tar: unexpected EOF." But, of course, GNU tar has an option to create old-format archives: --old-archive.