May 26, 2016

google history : my “tar” cheat sheet/bible

Posted on May 26, 2016  •  1 minutes  • 175 words  •  Suggest Changes

Years I have been using the tar command now, and still, this xkcd comic holds true :

I don’t know what’s worse–the fact that after 15 years of using tar I still can’t keep the flags straight, or that after 15 years of technological advancement I’m still mucking with tar flags that were 15 years old when I started.

While tar is not that complex, my brain refuses to learn these commands :

Create a archive (gzip compression)

tar cvfz archive.tar.gz dir/

c - create
v - verbose
f - archive name
z - use gzip

**Untar (/extract) an archive

tar xvfz archive.tar.gz

x - extract
v - verbose
f - archive name
z - use gzip

**Create a archive (using lz4 compression)
** lz4 is super fast and so when size is not really a problem its easy to use lz4. (for example to store short-term backups I tend to use lz4)

tar cvf - dir/ | lz4 - archive.tar.lz4

Untar (/extract) an lz4 archive

lz4 -dc --no-sparse archive.tar.lz4 | tar xvf -

d - decompression
c - cat to stdout
x - extract
v - verbose
f - file name (in this case - = stdout)

My search history includes way to many variations on “how to use tar” hence this mini cheat sheet.


If you enjoyed this website, consider buying me a Dr. Pepper

Buy me a Dr PepperBuy me a Dr Pepper