Hi,all: I've couple of large tarballs such as www.tar and images.tar. Is it possible to extract a single file or a list of files from a large tarball such as images.tar instead of extracting the entire tarball? How do I extract specific files under Linux / UNIX operating systems? Thanks in advance ~~ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20091111/e403e711/attachment-0003.html>
Hi, tar [ - ] A --catenate --concatenate | c --create | d --diff --compare | --delete | r --append | t --list | u --update | x --extract --get [ options ] pathname [ pathname ... ] pathname is what you're looking for. Sam ________________________________ From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On Behalf Of Majian Sent: Wednesday, November 11, 2009 9:16 AM To: CentOS mailing list Subject: [CentOS] About the tar extract signal directory~~ Hi,all: I've couple of large tarballs such as www.tar and images.tar. Is it possible to extract a single file or a list of files from a large tarball such as images.tar instead of extracting the entire tarball? How do I extract specific files under Linux / UNIX operating systems? Thanks in advance ~~ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20091111/1e99defb/attachment-0003.html>
On 11/11/2009 09:16 AM, Majian wrote:> Hi,all: > > I've couple of large tarballs such as www.tar and images.tar. > Is it possible to extract a single file or a list of files from a large > tarball such as images.tar instead of extracting the entire tarball? > How do I extract specific files under Linux / UNIX operating systems?Start by doing a: tar tvf www.tar to get a listing of the names in the tarball. If you need to restore a specific file or directory, do a: tar xvf www.tar ./www/specific/folder or tar xvf www.tar ./www/specific.file The files are restored relative to the current directory. The naming "./www/specific/folder" should match the list you got from the "tar tvf" command. The restore reads the whole archive, so it can take a while. Mogens -- Mogens Kjaer, Carlsberg A/S, Computer Department Gamle Carlsberg Vej 10, DK-2500 Valby, Denmark Phone: +45 33 27 53 25, Mobile: +45 22 12 53 25 Email: mk at crc.dk Homepage: http://www.crc.dk
Majian wrote:> Hi,all: > > I've couple of large tarballs such as www.tar and images.tar. > Is it possible to extract a single file or a list of files from a > large tarball such as images.tar instead of extracting the entire tarball? > How do I extract specific files under Linux / UNIX operating systems? >man tar
Majian wrote:> Hi,all: > > I've couple of large tarballs such as www.tar and images.tar. > Is it possible to extract a single file or a list of files from a large > tarball such as images.tar instead of extracting the entire tarball? > How do I extract specific files under Linux / UNIX operating systems?All versions of *Nix have man pages. These are like WinDoze help, except more technically detailed. T use them, do prompt> man <command or file> It's possible to see what might be related by doing prompt> man -k <subject> man tar <snip> EXAMPLES tar -xvf foo.tar verbosely extract foo.tar tar -xzf foo.tar.gz extract gzipped foo.tar.gz tar -cjf foo.tar.bz2 bar/ create bzipped tar archive of the directory bar called foo.tar.bz2 tar -xjf foo.tar.bz2 -C bar/ extract bzipped foo.tar.bz2 after changing directory to bar tar -xzf foo.tar.gz blah.txt extract the file blah.txt from foo.tar.gz <snip> mark