Skip to content

How to extract archive file in Linux

To extract archive file in Linux, you can use the tar command, used for extracting content from the archive files. “tar” stands for tape archive, which is used to create, maintain, modify, and extract files that are archived in the tar format.

tar [options] [pathname]

Following options are widely used with tar utility

A, –catenate, –concatenateAppend tar files to an archive.
c, –createCreate a new archive.
d, –diff, –compareCalculate any differences between the archive and the file system.
-v, –verboseOperate verbosely.
t, –listList the contents of an archive.
x, –extract, –getExtract files from an archive.

Refer below tar examples:

#Create a new tar archive.
$ tar cvf linux_archive.tar dirname/

Note: In above example, c means create a new archive, v means verbosely list files which are processed and f means following is the archive file name

#Extract from an existing tar archive.
$ tar xvf linux_archive.tar

#View an existing tar archive.
$ tar tvf linux_archive.tar

#To estimate the tar file size ( in KB ) before you create the tar file.
$ tar -cf – /directory/to/archive/ | wc -c
O/P: 20480

You may want to see
How to sort contents of a file

The sort command is used to sort the contents of a file. You can sort the data in a text Read more

How to use sed command in Linux

sed, short for "stream editor", allows you to filter and transform text. A stream editor is used to perform basic Read more

How to use crontab in Linux

Cron is the system process that will automatically perform tasks for you according to a set schedule. The schedule is Read more

How to Change permission of a file in Linux

chmod command is used to change the permission of a file in Linux. In Linux, there is a set of rules for Read more

Leave a Reply

Your email address will not be published.