Page 77 - RHEL8 BOOK
P. 77
1. To take the backup
[root@sun ~]# mkdir /Myfolder
[root@sun ~]# cd /Myfolder/
[root@sun Myfolder]# mkdir dir1
[root@sun Myfolder]# touch test1 test2 test3
[root@sun Myfolder]# ls
dir1 test1 test2 test3
[root@sun Myfolder]# tar -cvf Myfolder.tar /Myfolder
[root@sun Myfolder]# ls -ld Myfolder.tar
-rw-r--r-- 1 root root 10240 Oct 22 21:28 Myfolder.tar
2. To see the backup tables
[root@sun ~]# tar -tvf Myfolder.tar
[root@sun ~]# rm -r /Myfolder
3. To extract the backup
[root@sun Myfolder]# tar -xvf Myfolder.tar
4. To zip the tar file.
[root@sun Myfolder]# gzip Myfolder.tar
[root@sun Myfolder]# ls
dir1 Myfolder.tar.gz test1 test2 test3
[root@sun Myfolder]# ls -ld Myfolder.tar.gz
5. To unzip the tar file
[root@sun Myfolder] # gunzip Myfolder.tar.gz
6. To take backup along with zip (compressing)
[root@sun Myfolder] # tar –cvzf /dev/Linux9/java.tar.gz /java
7. To take backup along with zip (compressing)
[root@sun Myfolder] # tar –xvzf /dev/Linux9/java.tar.gz
CPIO Commands: - we can take the backup in relative mode as well as in absolute mode.
Relative mode: - syntax
<source> | cpio <options> <controller> <destination>
Options:-
-O out
-I in
-c Create
-t Table of backup content
8. To take the backup
[root@sun ~]# cd IIHT
[root@sun IIHT]# ls
[root@sun IIHT]# ls * | cpio -ocvf -O /Linux9/Backup.cpio1
S. Pradhan
(MCA, MBA-IT, BCA, CCNA, MCSA 2012, RHCE, ETHICAL HACKING)
Email Id:-spradhan.iiht@gmail.com
77