I have the Wordpress tar, latest.tar.gz. Within it is the following structure /wordpress/dirtories/files

When I do the following command I would prefer if I could have it unpack starting at /directories/ and not /wordpress with the goal of installing wordpress in the root of my html directory.

tar -xzvf latest.tar.gz

Is this possible?

Sorry, the tar contains /wordpress/[Directories] and I want all the directories in [Directories] extracted to the current directory. Sorry for misleading you all.

  • --strip is unrecognized on the server that Im on. Looking for an answer still.
    – Marc
    Aug 4, 2009 at 17:48
  • My version of tar is 1.13.25 btw.
    – Marc
    Aug 4, 2009 at 17:53
  • Have a look at this answer Oct 23, 2012 at 7:57

3 Answers 3


To strip down the parent directory:

tar zxvf latest.tar.gz --strip 1

If you want to be sure that nothing from the parent directory is extracted:

tar zxvf latest.tar.gz --strip 1 wordpress/directories


--strip (--strip-path or --strip-components) was introduced in tar 1.14.

  • I unchecked this as the answer because for some reason --strip isn't recognized. Any advice would be great.
    – Marc
    Aug 4, 2009 at 17:47
  • tar 1.14 was released over five years ago...surprising that some people don't have it yet
    – davr
    Aug 5, 2009 at 18:11

tar xvzf file.tar.gz -C /extract/point/

  • This does not do what I asked. Within the tar there is a root directory, I don't want that extracted, just everything under it.
    – Marc
    Aug 4, 2009 at 17:44
tar -xvzf file.tar.gz wordpress/*

will extract all the subdirectories (and files) of the wordpress folder into the current directory by creating a wordpress subdirectory. One way to "fool" the extraction by doing

ln -s . wordpress

and then running the tar extraction. The result will create each subfolder in the current folder because you linked the wordpress directory to the current directory.

Afterwards you can remove the wordpress symbolic link as it is no longer needed.

  • This is looking good. But the tar file has Wordpress/[LotsOfDirectories]. I'm updating my question. So, I want all the directories after Wordpress/ to be extracted and it looks like this sym link trick I would have to create a link for each of those directories? Is there another way?
    – Marc
    Aug 5, 2009 at 16:22
  • You should be able to use wordpress/* just as effectively as wordpress/directories and the symlink will still work since you're only trying to "redirect" the top level wordpress Aug 5, 2009 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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