Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to change the path of extraction of a .tar.gz archive. The files are supposed to extract as ./1/2/3/4/files, ./1/2/3files and so on.

The .1/2 part of those is common to all the files.

My question is, how can I modify the extraction path to extract into ./2/ and completely ignore the 1 directory?

share|improve this question
I assume Linux, but tagging the OS would probably be a good idea too. – EBGreen Feb 13 '12 at 20:20

Generally you use the --strip-components=n option for this using gnu tar. It strips n leading directories from the paths.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.