Archive

Posts Tagged ‘lzma’

Tarring up JUST the dotfiles

September 29th, 2009 5 comments

Want to tar up only the dotfiles (hidden files/dirs) in your home directory?

ls -A | egrep '^\.' | tar -cvJf filename.tar.xz -T -

or (thanks to mosk0bit)

tar -cvJf filename.tar.xz .??*

The astute will notice the “J” and the “xz”. J tells tar to compress with xz compression (formerly lzma) which is significantly better than gzip especially with the type of files you will expect to have in your hidden directories. If J is not available in your version of tar, use z instead.

Neither of these solutions are absolutely perfect, but they are at least simple. For the perfect score, see slava_dp’s comment:
http://blog.tpa.me.uk/2009/09/29/tarring-up-just-the-dotfiles/#comment-478