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:
Post a Comment