Tar is the most important command for Linux administrator and data backup engineer. Almost every day, we use this command to take the backup of a file or directory, moving data from a server to another, etc.

Tar stands for Tape archive.

Linux tar command most widely used for backup and archive data.

It is essential to archive multiple files and directory into a single file.

Here some examples of tar command which is used by System Administrator every day.

In this article, we will check how to use the tar command in your favorite Linux machine by using these three examples.

  1. Use tar command to create ‘tar’ archive file
  2. Use tar command to create tar.gz archive file
  3. Extract tar archive file


Use tar command to create ‘tar’ archive file

You can create a tar archive file by using the option “-cvf” as shown below:

The options described as:

c – it is used to create a new “.tar” archive file.
v – it is use to get the output of command verbosely
f – it applies to give the file name for the archive file.

Use tar command to create tar.gz archive file

You can create a gzip archive file with extension tar.gz using the “tar” command with option “z”.

For example, here we create a tar.gz archive file for linuxconcept home directory, as shown below:

The files with extension “tar.gz” and “.tgz” are similar.

Extract tar archive file

To extract “tar” file need to use option “x” with tar command, as shown below:

If you want to extract files in any specific directory, you can use the option “-C” to specify the directory when a file should extract, as shown below:

If You Like What We Do Here On LinuxConcept, You Should Consider:

Stay Connected to: Twitter | Facebook

Subscribe to our email updates: Sign Up Now


We are thankful for your support.

Follow me