How to extract one single file from a tar.xz file?

  • You can do this graphically with the archive software that was bundled with your distro. Open the tarball in the archive program and the interface will be like using the file manager. Navigate to the file you want, select it, and extract it (usually a menu and/or right-click action). – fixer1234 Jan 3 '16 at 18:34

This should work:

tar -xf file.tar.xz "/file/to/extract.png"

See here for some more syntax.


There are many ways to extract specific or selected files from a tar archive file, but the most used way in Linux using tar options as shown:

tar -tf filename.tar.gz filename

For more examples about tar command can be found at: http://www.tecmint.com/extract-tar-files-to-specific-or-different-directory-in-linux/

  • 1
    -t is for TEST, not extract. And I miss the uncompress option (z). – Hennes Jan 4 '16 at 10:19

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.