Linux: tar tips and tricks


Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /homepages/3/d98111892/htdocs/insanelabs/htdocs/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524

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>

One thought on “Linux: tar tips and tricks

  1. Pingback:
    Warning: Use of undefined constant user_level - assumed 'user_level' (this will throw an Error in a future version of PHP) in /homepages/3/d98111892/htdocs/insanelabs/htdocs/wp-content/plugins/ultimate-google-analytics/ultimate_ga.php on line 524
    tar and tarballs | SunOS

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.