How To Extract a Single File / Directory from Tarball Archive
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:
- How to install Linux / UNIX *.tar.gz tarball files
- Exclude certain files when creating a tarball using tar command
- How To Open .TBZ ( tar.bz2 ) File Under Linux / UNIX
- Command to run (execute) bin files in Linux
- Linux: Grub Boot into single user mode
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!
Tags: /dev/st0, bsd, bsd operating system, Linux, man page, operating systems, shell, tape, tar command, tar file, tar filename, tar gz, tar zxvf, UNIX ~ Last updated on: April 29, 2008



Recent Comments
Today ~ 17 Comments
Today ~ 2 Comments
Today ~ 37 Comments
Today ~ 46 Comments
Yesterday ~ 2 Comments