February 23, 2015

10 quick tar command examples to create/extract archives in Linux

Tar command on Linux
The tar (tape archive) command is a frequently used command on linux that allows you to store files into an archive.
The commonly seen file extensions are .tar.gz and .tar.bz2 which is a tar archive further compressed using gzip or bzip algorithms respectively.
In this tutorial we shall take a look at simple examples of using the tar command to do daily jobs of creating and extracting archives on linux desktops or servers.
Using the tar command
The tar command is available by default on most linux systems and you do not need to install it separately.
With tar there are 2 compression formats, gzip and bzip. The "z" option specifies gzip and "j" option specifies bzip. It is also possible to create uncompressed archives.
1. Extract a tar.gz archive
Well, the more common use is to extract tar archives. The following command shall extract the files out a tar.gz archive
$ tar -xvzf tarfile.tar.gz
Here is a quick explanation of the parameters used -
x - Extract files
v - verbose, print the file names as they are extracted one by one
z - The file is a "gzipped" file
f - Use the following tar archive for the operation
Those are some of the important options to memorise

Read full post here
10 quick tar command examples to create/extract archives in Linux

Read more at Binary Tides
Click Here!