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 tar.bz (bzip) file:

tar -jxf filename.tar.bz

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>

Creative Commons License
Linux: tar tips and tricks by Ali, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. Terms and conditions beyond the scope of this license may be available at insanelabs.com.

Filed under: Linux
Comments (0) Trackbacks (1)

Leave a comment