What is Tar and How to take Backup Using (Tar, Gzip, Bzip2, Zip) - Cloud Network

Networking | Support | Tricks | Troubleshoot | Tips

Buymecoffe

Buy Me A Coffee

Thursday, August 28, 2014

What is Tar and How to take Backup Using (Tar, Gzip, Bzip2, Zip)

Tar, Gzip, Bzip2, Zip
###Tar, Gzip, Bzip2, Zip###
Features:
 1. Compression utilities (gzip, bzip2, zip)
 2. File rollers (the ability to represent many files as one)

Gzip:
Includes:
 1. gzip - compresses/decompresses files
 2. gunzip - decompresses gzip files

Tasks:
 1. compress '1million.txt' file using gzip
  a. gzip -c 1million.txt > 1million.txt.gz

Note: gzip auto-dumps to STDOUT, by default

  b. gzip -l 1million.txt.gz - returns status information
  c. gunzip 1million.txt.gz - dumps to file, and removes compressed version
  d. gzip -d 1million.txt.gz
  e. zcat 1million.txt.gz - dumps the contents to STDOUT
  f. less 1million.txt.gzip - dumps the contents of gzip files to STDOUT


Bzip2:

 1. bzip2 -c 1million.txt > 1million.txt.bz2

Note: Bzip2 tends to outperform gzip on larger files
 2. bunzip2 1million.txt.bz2
 3. bzip2 -d 1million.txt.bz2
 4. bzcat 1million.txt.bz2 - dumps contents to STDOUT
 5. less 1million.txt.bz2 - also dumps the contents to STDOUT


Zip & unzip:
 1. zip filename.zip path/ - general usage
 2. zip 1million.txt.zip 1million.txt
Note: zip differs slight from gzip and bzip2 in that the destination file (resultant zip file) is specified before the source
 3. unzip 1million.txt.zip


Tar & Gzip/Bzip2:

 1. tar -cvf filename.tar path/ - creates a non-compressed archive
 2. tar -cvf 1million.txt.tar 1million.txt
Note: tar, requires a small overhead for itself in each file

 3. tar -czvf 1million.txt.tar.gz 1million.txt - creates, tar/gzip document
 4. tar -cjvf 1million.txt.tar.bz2 1million.txt - creates, tar/bzip2 document
 5. tar -tzvf

 6. tar -cjvf 1million.txt.tar.bz2 1million.txt testRH5/- creates, tar/bzip2 document for the text file and 'testRH5' directory tree.


Thanking You
Hope U like it....

Fedora 20 in Virtual box

Roboform in linux

Ubuntu server 12.04

Nagios 4.0.7

Oracle Linux 7
Free BSD 10