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:

/home/extract/home/lol/omnom

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.

S[email protected]

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

tar zxvf tarball.tar.gz -C destination_dir

Win.

Blog Logo

Mario Loria


Published

Image

./scriptthe.net

Because 127.0.0.1 gets old after a while.

Back to Overview