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.
Syntax:
tar [options] [pathname]
Following options are widely used with tar utility
A, –catenate, –concatenate | Append tar files to an archive. |
c, –create | Create a new archive. |
d, –diff, –compare | Calculate any differences between the archive and the file system. |
-v, –verbose | Operate verbosely. |
t, –list | List the contents of an archive. |
x, –extract, –get | Extract 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
The sort command is used to sort the contents of a file. You can sort the data in a text Read more
sed, short for "stream editor", allows you to filter and transform text. A stream editor is used to perform basic Read more
Cron is the system process that will automatically perform tasks for you according to a set schedule. The schedule is Read more
chmod command is used to change the permission of a file in Linux. In Linux, there is a set of rules for Read more