Lazy Mans Guide to Tarring Files

Posted (Updated ) in Linux

I’m a developer. That makes me lazy. If you’re a developer, chances are you’re lazy too. So to help you not need to read, here is the code to recursively tar and untar files (with and without compression):

tar -cvf filename.tar target1 target2 #without compression
tar -cvzf filename.tar.gz target1 target2 #with compression (Just add z)

To untar, simply replace c with x:

tar -xvf filename.tar path #without compression
tar -xvzf filename.tar.gz path #with compression (Just add z)

Courtesy of @nigelheap http://nigelheap.com