Tar and Untar in HP UX
Tar utility can be helpful while taking a backup. Note that tar can preserve the file's permission and its mode.
For example, I have the following directory structure:
/home/oracle/himanshu/database
/home/oracle/himanshu/database/data
/home/oracle/himanshu/database/12.1.0
Create a tar archive
tar cvf database.tar /home/oracle/himanshu/database
If you want to include into your archive several different directories you might use the following command:
tar cvf database.tar -I include.lst
where the -I option specifies the name of a file with a list of directories and files that you want to include into your archive.
Also, it's possible to exclude certain files and directories from your archive:
tar cvfX database.tar exclude.lst -I include.lst
List an archive contents
tar tf database.tar
Extract from an archive
tar xvfp database.tar
Please note that everything will be extracted exactly at the same location from where it was taken. If some directories do no exist then they will be created.
Tar's options
c - add to the archive, using an absolute path
x - extract from the archive
t - read the contents of an archive
f - you work with a file, otherwise, it's a tape
p - preserve file's permissions and modes
v - verbose, display the result
-I - use an include list
X - use an exclude list
If you like please follow and comment
Post a Comment
Post a Comment