Linux: tar tips and tricks

To untar a tar file:

tar xf filename.tar

To untar a tar.gz or tar.tgz (gzip) file:

tar -zxf filename.tar.(t)gz

To untar a (bzip) file:

tar -jxf

To untar a tar.bz2 (bzip2) file:

tar -yxf filename.tar.bz2

To view a list of files in an archive:

tar -tzf filename.tar.gz

If the archive contains numerous files and you’d like to be able to view line by line:

tar -tzf filename.tar.gz | more

To untar an archive to a different directory:

tar -zxf filename.tar.gz -C <directory>

CC0 1.0
To the extent possible under law, the creator has waived all copyright and related or neighboring rights to this work.

One thought on “Linux: tar tips and tricks

Leave a Reply

Your email address will not be published. Required fields are marked *

five × 9 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>