Archive files

Archive files and directories into a compressed file using tar, and extract the contents of an existing tar archive.

Task 1:

Create backup file named /root/backup.tar.bz2 The backup file should contain the content of /usr/localand should be zipped with bzip2compression format.

Furthermore, ensure SELinux is in enforcing mode, If it is not, change SELinux to enforcing mode.

Solution:

tar -cvjf /root/backup.tar.bz2 /usr/local
getenforce # check if selinux is in enforce mode
setenforce 1

Task 2:

Create backup file named /root/backup.tar.bz2, which contains the contents of /usr/local, bar bust use bzip2compression.

Solution:

tar -cvjf /root/backup.tar.bz2 /usr/local

Last updated

Was this helpful?