0% found this document useful (0 votes)
16 views

Basic Commands in Linux With Examples

The document discusses the TAR command which is used to archive and compress multiple files into a single file. It explains different compression methods like gunzip, bunzip2, and XZ which create compressed files with different extensions and compression speeds. Instructions are provided on how to use TAR to archive, compress, list, and extract files using these different compression methods.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Basic Commands in Linux With Examples

The document discusses the TAR command which is used to archive and compress multiple files into a single file. It explains different compression methods like gunzip, bunzip2, and XZ which create compressed files with different extensions and compression speeds. Instructions are provided on how to use TAR to archive, compress, list, and extract files using these different compression methods.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

WebAsha Technologies:

TAR command: (Tape Archive)


To create archive file and commpress a number
of file.

1- Archieve: To combine multiple file into single file.


2- Compression: To reduce the size of file but data will not be lost.

Tar cmd: 1- step => create a archive file


2- step => compression method to compress the file

compression method:

1- gunzip ===> create compress file with '.gz' extension


2- bunzip2 ===> create compress file with '.bz2' extension
3- xz ===> create compress file with '.xz ' extension

difference between Gunzip, bunzip2 and XZ

Gunzip bunzip2 XZ
1- extension file .gz .bz2 .xz
2- compression speed is speed is slow speed is very
slow
very fast than gunzip than any.
3- compression ratio is ratio is better ratio is too
less than bunzip and XZ than gunzip good than other
*************************************************************************
*****
Only for Achive==>
Syntax: # tar -<option> <archieve filename.tar> <source1>
<source2> <source3>

Option:

c= to create archieve
r= to append the data in Tar file.
t= to check list of data in tar file
v= Verbose
x= extract
f= from file (mendatory)
C= to change the extract location
******************************************************
z= compress with gunzip method
j= compress with bunzip2 method
J= compress with xz method

*****************************************************
For Archieve:

cvf= to create # tar -cvf Network.tar abc1 abc2 abc3


rvf= to append # tar -rvf Network.tar abc4 abc5
tvf= to check list # tar -tvf Network.tar
xvf= to extract # tar -xvf Network.tar -C /path

For Compress:
czvf= to compress in gunzip #tar -czvf Network.tar.gz abc1 abc2 abc3
cjvf= to compress in bunzip2 #tar -cjvf Network.tar.bz2 abc1 abc2 abc3
cJvf= to compress in xz #tar -cJvf Network.tar.xz abc1 abc2 abc3

*************************************************************************
***

Difference of Command:

1- TAR====> Archieve + Compress

2- gzip
3- bzip2 Only commpress==> 1- any normal file
4- xz But original file 2- any tar file
of both type
*************************************************************************
Create compress in Gunzip:

# gzip <filename> ===> it will compress with .gz format automatically

Decompress the gunzip file:

# gunzip <filename.gz>
*************************************************************************
*

Create compress in bunzip:

# bzip2 <filename> ===> it will compress with .bz2 format automatically

Decompress the bunzip file:

# bunzip2 <filename.bz2>

*************************************************************************
*
Create compress in XZ:

# xz <filename> ===> it will compress with .xz format automatically

Decompress the XZ file:

# xz -d <filename.xz>
*************************************************************************
*

You might also like