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...

78 Responses

  1. talah shaikh says:

    thanks very much for this tar command information document.

  2. Sunil says:

    In this sentence “The tar is most widely used command to create compressed archive files and that can be moved easily from one disk to “anther” disk or machine to machine.”
    anther should be another.

    And thanks a lot for this tutorial.

  3. Rashmi says:

    Thanks for posting the information.

    It would be good if you could address the following in this page.

    1) Missing word – In this article we will going to review – ‘be’ is missing between ‘we’ and ‘going’ words
    2) Missing word – that might be helpful you – ‘for’ is missing between ‘helpful’ and ‘you’ words
    3) Sentence Correction – Let’s discuss the each option we have used in the above command for creating tar archive file.
    Correction: Let’s discuss each option that we have used in the above command for creating a tar archive file.
    4) Not required: The following example of command – ‘of’ is not needed
    5) Missing word: If you want untar in a different – ‘to’ is missing between ‘want’ and ‘untar’
    6) Correction: To list the content of tar archive file – ‘content’ should be ‘contents’ (Replace ‘content’ with ‘contents’ at appropriate location)
    7) Correction: to a existing compressed tar.gz – ‘a’ should be ‘an’
    8) Correction: If we do try will get tbe following error – ‘tbe’ should be ‘the’
    9) Spelling: ‘archvie’ should be ‘archive’
    10) Spelling: ‘patters’ should be ‘patterns’

  4. David Zuccaro says:

    why do you need a – with option cvf and not need it with option cvfz?

  5. Binh Thanh Nguyen says:

    Thanks, nice tips

  6. Ferdinant says:

    Very nice, and now the second most important one is missing, namely: how to create split tar files into blocks of certain size.

    Anyway it helped me on my way.


    • Ravi Saive says:


      Thanks for finding it helpful, and also thanks for telling about that missing topic “how to create split tar files into blocks of certain size“, we will surely write on this topic and publish it by next week, till then stay tuned to TecMint.com

  7. While extracting a particular file from the tarball, just giving a file name doesn’t work. You need to give the path of the file within the tarball.
    For example: I have taken a backup of my home directory called “/home/aziz” and it contains test1 and test2 files.

    $ tar -xvf /tmp/aziz.tar test1 — This command does not work while extracting a particular called test1
    $ tar -xvf /tmp/aziz.tar home/aziz/test1 — This command works while extracting a file called test1
    $ tar –extract –file=/tmp/aziz.tar home/aziz/test1

Got something to say? Join the discussion.

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