Hacker News new | ask | show | jobs
by Tepix 3198 days ago
> 6. List contents of tar.gz and extract only one file

> tar -ztvf file.tgz

> tar -zxvf file.tgz filename

Tar no longer requires the modifier for the compression when extracting an archive. So no matter if it's a .tar.gz, .tar.Z, .tar.bz2, etc you can just use "tar xvf"

2 comments

And the same for compression..

    tar caf foo.tar.xz foo/
The extension of the file after the `f` switch tells tar what compression to use.

c - compress

a - auto

by tar you mean gnu tar