Compress, Archiving, Extract using tar, gzip and bzip2 tools

compress linux, archiving linux tar, linux archiving tools, tar linux, gzip linux, gzip command in linux, gzip compression, bzip2 linux, bzip2 tools

Compress, Archiving and Extract using tar, gzip and bzip2 in Linux
Compression is a technique to reduce the size of bunch of files stacked together. Archiving is a method to make single file of multiple files and folders.

It has 2 steps, Archiving & compression:


1. Archiving:

This is a process of collecting the files which have to be compressed and make a single file out of them, that is called archiving.

An Archive is made using "tar"(Tape Archive Command).

[root@selva ~]#  tar -cvf example.tar *

Above command makes as an archive "example.tar" & puts all the files in current directory in it.

To list out the archived and compressed content without extracting as below,

[root@selva ~]#  tar -tvf example.tar


2. Compression:

There are various tools to compress the file. They are follows:


Compress & Uncompress Tool:

To compress the file use the following command:

[root@selva ~]# compress example.tar

Above command makes a compressed file  example.tar.Z in the current directory.

To uncompress the file use the following,

[root@selva ~]# uncompress example.tar.Z

Shortcut command to do compressing is,(Archiving + Compression)

[root@selva ~]# tar -Zcvf example.tar.Z

Shortcut Command to do the uncompressing is (Archiving + Uncompressing)

[root@selva ~]# tar -Zxvf example.tar.Z

GZIP & GUNZIP Tool:

To compress the file Gzip tool is used..

[root@selva ~]# gzip example.tar

Above Command makes a compressed file example.tar.z in the current directory.

To Uncompress the file Gunzip tool is used..

[root@selva ~]# gunzip example.tar.z

Shortcut command to do the compressing is (Archiving + Compression )

[root@selva ~]# tar -zcvf example.tar.z

Shortcut command to do Uncomressing ( Archiving + Uncompression )

[root@selva ~]# tar -zxvf example.tar.z

BZIP2 & BUNZIP2 Tool:

To compress the file using bzip tool,

[root@selva ~]# bzip2 example.tar

Above command makes a compressed file example.tar.bz2 in the current directory.

To Uncompress the file bunzip2 tool is used,

[root@selva ~]# bunzip2 example.tar.bz2

Shortcut command to do the compressing ( Archiving + Compression )

[root@selva ~]# tar -jcvf example.tar.bz2

Shortcut command to do the uncompressing ( Archiving + Uncomression )

[root@selva ~]# tar -jcvf example.tar.bz2

linux compress, linux compress, compressing linux, archiving linux, archiving linux tar, linux archiving tools, tar linux, tar xvf, tar cvf, gzip linux, gzip command in linux, gzip compression, bzip2 linux, bzip2 command in linux, bzip2 vs gzip
May 29, 2015

Post a Comment

[disqus][facebook][blogger]

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget