In case of corruption, we will get the output something like below, If above command does not generate any output on the screen then we can say that there is no corruption. $ sudo tar -xpvf system-back.tgz -C /var/tmp/įor tar ball, use ‘-tf’ option and redirect the output to /dev/null file, $ tar -tf system-back.tar > /dev/null In the following example we are extracting system-back.tgz in /var/tmp folder. In case you want extract it in a particular folder then use ‘ -C’ option followed by the folder path. This command will extract system-back.tgz in the current working directory. Example is shown below $ sudo tar -xpvf system-back.tgz Use ‘ -x’ option in tar command to extract tar backup, complete option would be ‘ -xpvf’. Example is shown below: $ sudo tar -tvf system-back.tgz | grep -i etc/fstab To view the contents of tar backup, use ‘ -t’ option, complete options would be ‘ -tvf’. ![]() Run following command to exclude files mentioned in exclude.txt while creating tar backup of /etc $ sudo tar -X exclude.txt -zcpvf etc-backup.tgz /etc How to view the contents of tar backup? To use exclude feature we must create a exclude file which will have file name to be excluded. To exclude a file while creating tar backup, use ‘ -X’ option followed by the exclude file. ![]() How to exclude file while creating tar backup? Note: We can not append files or folders to compressed tar backup as it is not supported. Let’s assume we want to append /root/app.yaml file to system-backup.tar, run $ sudo tar -rvf system-back.tar /root/app.yaml ![]() Let’s assume we want to take backup of / home/linuxtechi, /etc and /opt folder. To create a tar backup file, first identify the files and folders that would be part of your backup. How to view the contents of tar backup?.How to exclude file while creating tar backup?.Creating tar backup along with bzip compression.Creating tar backup along with gzip compression.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |