Bash tar Command - An archiving utility
Using the tar Command
The tar command is used to create, maintain, modify, and extract files from an archive file.
TAR Options Overview
Here are some common options you can use with the tar command:
-c- Create a new archive-x- Extract files from an archive-t- List the contents of an archive-z- Filter the archive through gzip-v- Verbosely list files processed-f- Specify the filename of the archive
Option: -c (Create)
The -c option creates a new archive with the specified files.
Option: -x (Extract)
The -x option extracts files from an archive.
Option: -t (List)
The -t option lists the contents of an archive without extracting them.
Example: List Archive Contents
tar -tvf archive.tar
-rw-r--r-- user/user 1234 2025-04-10 12:00 file1
-rw-r--r-- user/user 5678 2025-04-10 12:00 file2
Option: -z (Gzip)
The -z option filters the archive through gzip, compressing or decompressing it.
Option: -f (File)
The -f option specifies the filename of the archive to create or operate on. It should be used as the last option before the archive name.
Option: -v (Verbose)
The -v option provides verbose output, listing files as they are processed.