Linux Tricks and Techniques

For Linux Experts

Use the website for easy leaning of Linux

Monday, 6 June 2016

File Compression in Linux

Archive Files in Linux



Archive is used to compress multiple file into a single file. These are of Two Types

                      1) Tar  2)Jaar
    
Tar is used to copy multiple file into a single file.



Jaar is used to compress multiple file into single file.
Some of the Examples of this Tar and Jaar are given below:

Tar
How to create a tar file
# tar –cvf  targetfile.tar  source file
Ex: tar –cvf ram.tar  r1,r2,r3

Here
c is for create
v- verbose mode
f- path of file

How to view the tar file
# tar –tvf filename.tar
t- view
How to extract a tar file
# tar –xvf filename.tar
x- extract

Jaar

How to create jaar file
# jaar –cvf targetfile.jaar source file
For view
# jaar –tvf filename.jaar

For Extract
# jaar –xvf filename.jaar

File Compression
Compress is used to compress a file
# compress filename
When we run this command it replace the original file with .z extension

Uncompress
# uncompress filename
Tha file name will be with .z
To read a compress file
#zcat filename.z
This command is used to show contents of file.
# gzip filename
Will compress with .gz extension
#gunzip filename.gz
For view
# gzcat filename.gz

Zip is used to reduce the file of multiple file
# zip target.zip file1,file2,file3
When we reduce the file of size with zip command it replace the original file with .zip extension.

Unzip is used t restore the file which compressed with zip cmnd
# unzip filename.zip

These are the useful commands used for the file compression and decompression in Linux.

Thanks




No comments:
Write comments