• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

what does .tar file mean

by admin

Linux often uses two particular utilities to help manage files. The first utility is tape archiver, or tar. The second is a compression utility such as gzip. The purpose of tar is to bundle together multiple files into a single tarball with a .tar extension. This makes functions like downloads much easier, since there is only one download necessary to acquire multiple files. The server administrator creates the bundle of files, and whoever downloads the bundle extracts the files from it.

It is essential to know how to work with tar because a great deal of the software available for Linux is distributed in tarballs. The following is an example of creating a tarball:

# tar -cvf tarball.tar file1 file2 file3

This bundles file1, file2, and file3 into a tarball named tarball.tar.

tar Command Options

Option Used To
-c Create the tarball
-x Extract the tarball.
-v Enable verbose mode.
-r Append more files to an existing tarball.
-t Test the tarball or see what files are included in the tarball.
-f Specify the name of the tarball in the next argument (must be used as the last option).

tar Command Examples

1. [c]reate an archive and write it to a [f]ile:

# tar cf target.tar file1 file2 file3

2. [c]reate a g[z]ipped archive and write it to a [f]ile:

# tar czf target.tar.gz file1 file2 file3

3. [c]reate a g[z]ipped archive from a directory using relative paths:

# tar czf target.tar.gz --directory=path/to/directory .

4. E[x]tract a (compressed) archive [f]ile into the current directory [v]erbosely:

# tar xvf source.tar[.gz|.bz2|.xz]

5. E[x]tract a (compressed) archive [f]ile into the target directory:

# tar xf source.tar[.gz|.bz2|.xz] --directory=directory

6. [c]reate a compressed archive and write it to a [f]ile, using [a]rchive suffix to determine the compression program:

# tar caf target.tar.xz file1 file2 file3

7. Lis[t] the contents of a tar [f]ile [v]erbosely:

# tar tvf source.tar

8. E[x]tract files matching a pattern from an archive [f]ile:

# tar xf source.tar --wildcards "*.html"

Filed Under: Linux

Some more articles you might also be interested in …

  1. Basic Commands to Troubleshoot Performance Issues in Linux
  2. ffplay: A simple and portable media player using the FFmpeg libraries and the SDL library
  3. hexyl Command Examples
  4. Understanding How Umask Controls the Initial File / Directory Permissions in Linux
  5. make Command Examples in Linux
  6. ark: command not found
  7. encfs: Mounts or creates encrypted virtual filesystems
  8. flips: Create and apply patches for IPS and BPS files
  9. flameshot Command Examples in Linux
  10. ipfs Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright