Linux- How to‎ > ‎

Ch 05 Compression & Backup

  • zip
  • comress
  • gzip
  • bzip2


#zip test  (directory name)

#bzip test (directory name)

#ls

Result will be
Test.z  test.bz2

#uncompress test.z
#uncompress test.bz2


#gzip test
#uncompress test

#gunzip test

Backup

TAR  = TAPE ARCHIVE

#tar –cvf newfile.tar   (filename)

C= Create
V= Verbose
F= file

#tar –cvf /backup/file.tar /root/file1

----------------   ----------
destination        source

(we can use a* for file which start with a)

(also use *.* for directory)

#tar –cvf  hi.tar  a*
------
(file)
#tar –tvf file2.tar (to see the contain of file)


Restore

#tar –xvf file2.tar
x= extract  (as per this command file will extract in /root)

(for ZIP File command will be like under:)

#tar –Zcvf file.tar.z  (to compress Z is cap)

#tar –Zxvf file.tar.z  (to extract Z is cap)

#tar –zcvf file.tar.gz  (gzip) (z is small)

#tar –zxvf file.tar.gz  (gzip)

#tar –jcvf file.tar.bz2 (bzip)

#tar –jxvf file.tar.bz2 (bzip)


#tar –cvf newfile.tar  newfile1,newfle2,newfile3
(to add more file in 1 archive)



(to take bakup of directory)

#tar –cvf –c fle1.tar  test  (test is directory)

#tar –tvf –c

#tar –xvf –c

#tar –cvf newdir.tar existingdir/

#tar –xvf directory.tar
Comments