Reputation: 110382
I have the following archived directory:
itunes20140618.tbz
I want to extract single file from it called:
itunes20140618/video
How would I do this?
So far, I am doing
$ bzip2 -d /tmp/itunes20140618.tbz
But it seems to create a tar directory of everything. How would I extract just the single video file?
Upvotes: 1
Views: 2419
Reputation: 4396
There are a few different versions of tar
around, but on my machine I can do this:
tar xjf archive.tbz filename
To extract filename from archive.
If that doesn't work you can use:
bzip2 -dc archive.tbz | tar xvf - filename
Which uses bzip2
to extract to stdout and then pipe to tar
.
In both cases you can replace the x
option with t
to get a list of files. Eg:
tar tjf archive.tbz
Upvotes: 5
Reputation: 158080
You can use the tar
command and pass the path of the desired file or folder as an argument to it:
tar xjf test.tbz /path/to/file/in/archive
Upvotes: 0