All tar backup commands

Tar is a backup utility in Linux operating systems, used for archiving and backup purpose also. Comes with the file extension ".tar". 


Verify Tar package installed in your rpm based Linux machine.(normaly preinstalled)
[root@server ~#]rpm -q tar
tar-1.23-3.el6.x86_64


Backup a file or Folder
Syntax: tar -cvf <new tarball.tar> <destination file/folder>
[root@server ~#]tar -cvf /backup/images.tar /home/admin/Pictures
The above command backups the directory "Pictures" as a tarball(images.tar) in "/backup" 


Restoring a tarball
Syntax: tar -xvf <tarball.tar>
[root@server ~#]tar -xvf /backup/images.tar
The above command will restore the tarball to the original destination. (/home/admin/Pictures)


Display contents in tarball
[root@server ~#]tar -tvf /backup/images.tar


Compress the tarball with Gzip
Syntax: tar -zcvf <tarball.tar> <gziptarball.tgz>
[root@server ~#]tar -zcvf /backup/images.tar /backup/images.tgz
Above command will gzip the tarball to specified location (highly compressed tar)


Restore a gzipped tar file
Syntax: tar -xzvf <gziptarball.tgz>
[root@server ~#]tar -xzvf /backup/images.tgz
Restores the tar file to the original location



swiches used
  • c = create
  • v = Verbose
  • f = filename of tarball
  • t = table of contents
  • x = extract contents
  • z = zip

0 comments:

Related Posts Plugin for WordPress, Blogger...

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Bluehost Coupons