$ tar -caf some_dir.tar.xz some_dir

the -a flag causes tar to automatically pick the right compressor to filter the archive through, based on the file extension. e.g.

“tar -xaf archive.tar.xz” is equivalent to “tar -xJf archive.tar.xz”

“tar -xaf archive.tar.gz” is equivalent to “tar -xzf archive.tar.gz”

No need to remember -z is gzip, -j is bzip2, -Z is .Z, -J is xz, and so on :)

View this command to comment, vote or add to favourites
View all commands by thetrivialstuff

commandlinefu.com

by David Winterbottom (codeinthehole.com)


Tags: