So the title might be misleading but picture this:

tar czvf lol.tgz /home/lol/omnom

When you run that, it will tar up that directory. It will also put leading directories up to the actual data in the directory you’ve specified.

So when you go to extract it to lets say /extract, you’ll get:


Here is how to avoid that straight from one of my favorite sites: stackoverflow

tar -czvf lol.tgz -C /home/lol/omnom .

This tells tar to jump in that dir and then grab everything (including hidden files etc..) and throw that in the archive.


Ohh and you want to untar to a specific directory that is not your current directory????

tar zxvf tarball.tar.gz -C destination_dir


Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.