18 Tar Command Examples in Linux

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.95/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. 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. Follow Me: Twitter, Facebook and Google+

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

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

77 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:

      @Franklin,
      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:

          @Suneel,
          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!

Got something to say? Join the discussion.

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