![]() |
Software >
An omnipresent file archiver.
-
Tape Archiver
Table of Contents [hide]
Usage ∞
Uncompressing .tar archives ∞
It’s amazingly inobvious, but to untar something is:
\tar -xvf filename.tar
For gzip compression:
# With the multiple-extension \tar -xvvf filename.tar.gz # Or with the .tgz extension \tar -xvvf filename.tgz
For bzip2 (better) compression:
\tar -xvvzf filename.tar.bz
I don’t know why it’s too stupid to just know what to do based on the filename. That’s UNIX for you. Stupid stupid stupid.
Making tar archives ∞
# File(s) \tar -czvf filename.tgz file1 file2 # Directory \tar -czvf filename.tgz dir/ \tar -czvf filename.tar.gz dir/ # Directory, gzip \tar -czvzSf filename.tgz dir/ # Directory, bzip2 \tar -cvjSf file.tar.bz2 directory/ \tar --create --verbose --bzip2 --sparse --file=file.tar.bz2 directory/
Make the tarball — all files and all dotfiles in the current directory.
\tar -czvf $0.tar.gz * $( \ls -A | \grep "^\." )
All files, even dotfiles, but not .svn (Subversion) or anything in a .svn directory.
\tar --exclude ".svn" -czvf new_archive.tar.gz * $( \ls -A | \grep "^\." )
Merging directories ∞
\cf - . |(cd /targetdir; tar xvf -)
Tested and works.
Notes ∞
- tar is very good about preserving attributes.
-
This is slower than I’d like, and it appears to be doing a copy-before-move.


ported
added bzip2 directory compression
updating the compression, I think it was wrong