18 Tar Command Examples in Linux

If you have any questions or problems regarding this article and want help within 24 Hours? Ask Now

Support TecMint: Did you find this tutorial helpful?. Please help to keep it alive by donating. Every cent counts! - Donate Now

Ravi Saive

Simple Word a Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

Receive Your Free Complimentary eBook NOW! -

Download Free Linux eBooks

Advanced Bash-Scripting Guide
Linux Bible
A Newbie's Getting Started Guide to Linux
Introduction to Linux - A Hands on Guide

You may also like...

68 Responses

  1. Ahmad Joya says:

    Thanks a lot.
    very useful topics!

  2. Abhijit says:

    I think on on example 5 and 6 for untaring, -z and -b flags respectively are missing. But anyway thanks for this great tutorial.

  3. jagadish says:

    nice explanation……..

  4. Gabriel S says:

    I’ve got this bookmarked! It’s really helpful – thanks for posting this. I refer to it constantly when I’m SSHing and moving WordPress installations around!

  5. Swati says:

    Hi Ravi,
    I am trying to create tar file at AIX server using the below command:
    tar cvf temp.tar temp/
    but its just giving me tar: and create 0 byte tar file.
    I tried diffrent options like tar -cvf, tar cf, tar -cf, temp/,temp, complete path but for all I m getting same reposne.
    Please help :(

  6. MADHU says:

    Good read, useful information . I also would like to understand how we can overwrite the file in the directories if already exist.

  7. Dev says:

    Thanks guys,
    This is really very helpful for all archiving formats :)

  8. Ahmed says:

    Salaam Ravi,

    Thanks for this valuable tricks and tips, personally it helped me a lot.
    By the way I am new bie to linux.

    Ahmed Somali

  9. Franklin says:

    Note to the author:

    some of the filename is you tar examples look like adult photos to me (e.g. Miley**photo101203.flv). Just want to let you know in case that was not on purpose…

    Thanks for the helpful tutorial.

    • Ravi Saive says:

      What a finding….:) even I don’t know that I’ve used such images in my tar command examples. Actually I handle one large photo site in our media company. I think I tried those commands on that server and taken those images as example for tar command…..

      • Suneel says:

        Hi Ravi,

        Still Mileys & Justintimerlakes did not put clothes in Example 2 and Example 5.

        BTW..thanks for the article.

        • Ravi Saive says:

          Oops, good catch actually the examples taken from our production server where photo gallery is hosted.

  10. langacker says:

    Thanks! Great tutorial for linux beginner!

Leave a Reply

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

Join Over 85000+ Linux Users
  1. 53,676
  2. 2,838
  3. 20,639

Enter your email to get latest Linux Howto's