2 Tar Command Examples in Linux

2 Tar Command Examples in Linux

The Linux “tar” stands for tape archive, which is used by large number of Linux/Unix system administrators to deal with tape drives backup. The tar command used to rip a collection of files and directories into highly compressed archive file commonly called tarball or targzip and bzip in Linux. The tar is most widely used command to create compressed archive files and that can be moved easily from one disk to another disk or machine to machine.

In this article we will be going to review and discuss various tar command examples including how to create archive files using (tartar.gz and tar.bz2) compression, how to extract archive file, extract a single file, view content of file, verify a file, add files or directories to archive file, estimate the size of tar archive file, etc.

The main purpose of this guide is to provide various tar command examples that might be helpful for you to understand and become expert in tar archive manipulation.

1. Create tar Archive File

The below example command will create a tar archive file tecmint-14-09-12.tar for a directory /home/tecmint in current working directory. See the example command in action.

Let’s discuss each option that we have used in the above command for creating a tar archive file.

  • c – Creates a new .tar archive file.
  • v – Verbosely show the .tar file progress.
  • f – File name type of the archive file.

2. Extract a tar.gz archive

tar -xfv bigfile.tar.gz

Leave a Reply

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

three × 5 =

Chat kami
Hubungi kami via WhatsApp.