About Linux FAQ

Browse More FAQs:

How To Extract a Single File / Directory from Tarball Archive

Posted by Vivek on Tuesday April 29, 08 (2 weeks ago) @12:04 am

Q. How do I extract a single file or directory form a tarball under UNIX / Linux shell prompt? How do I restore a single file from /dev/st0 tape device?

A. tar command allows to extract a single file or directory using the following format. It works under UNIX, Linux, and BSD operating systems.

tar xvf /dev/st0 filename
tar xvf /dev/st0 directory-name
tar xvf mytar.ball.tar filename
tar -zxvf mytar.ball.tar.gz directory-name

Extract file to /tmp directory
tar -zxvf mytar.ball.tar.gz -C /tmp filename
tar -zxvf mytar.ball.tar.gz -C /tmp dir-name

Read tar man page for more information:
man tar

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Linux / UNIX FAQ:

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Please do not use the comment form to ask for help / question. Ask your question on the excellent Linux tech support forum. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , , , , , , , , , ~ Last updated on: April 29, 2008

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.