Sunday, July 19, 2015

Maintenance of linux system

BACKUP


Commands for Backup

tar
Options:
c         --  create
v         -- verbose means it will show all the error while creating creating backup.
p         -- same permission i.e. maintains the same permissions of file which is backed-up
f          -- specifies filename
t          -- table of content
x          -- extract to
z          -- zip/gzip
w        -- ask for confirmation

To create a backup

Type1: tar --create --verbose --same-permission --file /usr/backup1 /home /etc
Type2: tar -cvpf /usr/backup1 /home /etc

c-create
v-verbose  
p-maintains the same permissions of file which is created
f-to create a file
/usr  is the directory were backup is saved
backup1 is the name of backup file created
/home & /etc are the directory for which backup is created
 

To extract the content from backup
tar -xvpf /usr/backup1


To extract a specific file from backup
tar -xvpf /usr/backup1 /home/haktuts.txt
to extract haktuts.txt file from backup1 to the directory /home/haktuts.txt


To list the content of backup
tar -tvf /usr/backup1 | more
list view of files in backup useful for recovering file which name is not known


To create a zip file
zip
e.g. zip hak /usr
hak is the filename
/usr is the directory to save the zip file


To extract the zip file
unzip hak /etc


To create a gzip file
gzip filename
e.g: gzip hak


To extract a gzip file 
gzip -d filename
e.g.: gzip -d hak.gz

No comments:

Post a Comment

Evil Twin attack

Evil Twin Attack is attack is frequently carried upon wireless access points with malicious intentions. This attack happens when...