An omnipresent file archiver.
.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/
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
\tar --exclude ".svn" -czvf new_archive.tar.gz * $( \ls -A | \grep "^\." )
Merging directories ∞
\cf - . |(cd /targetdir; tar xvf -)
Tested and works.
- tar is very good about preserving attributes.
This is slower than I'd like, and it appears to be doing a copy-before-move.