Unpack individual files from tarball

Say you don't want to unpack the whole thing, just individual files or directories within a .tgz. How to do this?

just supply the filename(s) that exactly match names inside the tarball on your tar -x argument list.
e.g.

$ gzcat foo.tgz | tar -xf - exact/path/to/filename1
1 Like