Introduction
In this challenge, you will create compressed tar archives of the /home
directory using both gzip and bzip2 compression methods, and then extract them. This skill is essential for system administrators who need to efficiently backup and transfer large amounts of data.
Environment
LabEx uses Red Hat Universal Base Image 9 (UBI9) to simulate the exam environment. It may not be identical to the actual RHCSA exam environment, but it provides a good representation of the tasks you’ll encounter.
There are two users in the environment:
-
labex
: A standard user with sudo privileges, password:labex
. -
root
: The system administrator, password:redhat
.
The challenge features real exam questions, along with explanations, requirements, and automated verification scripts to help you confirm task completion. It effectively simulates the knowledge areas covered in the RHCSA exam.
Create and Extract Compressed tar Archives
Tasks
- Create gzip and bzip2 compressed tar archives of the
/home
directory - List the contents of both archives
- Extract both archives
Requirements
- Perform all operations in the
/home/labex
directory - Create the following archives:
- Gzip-compressed:
/home/labex/home.tar.gz
- Bzip2-compressed:
/home/labex/home.tar.bz2
- Gzip-compressed:
- List the contents of both archives in
/home/labex
- Extract both archives to
/home/labex/extracted
- Use the
tar
command with appropriate options for all operations
Example
After creating the gzip-compressed archive, listing its contents might look like this:
$ tar -tvf /home/labex/home.tar.gz
drwxr-xr-x root/root 0 2023-08-28 10:00 home/
drwx------ labex/labex 0 2023-08-28 10:00 home/labex/
-rw-r--r-- labex/labex 220 2023-08-28 10:00 home/labex/.bash_logout
-rw-r--r-- labex/labex 3771 2023-08-28 10:00 home/labex/.bashrc
-rw-r--r-- labex/labex 807 2023-08-28 10:00 home/labex/.profile
Summary
In this challenge, you learned how to create compressed tar archives using both gzip and bzip2 compression methods, as well as how to list their contents and extract them. You practiced using the tar
command with various options to perform these tasks in specific directories, enhancing your command-line skills and understanding of file compression techniques in Linux systems.
🚀 Practice Now: Create and Extract Tar Archives
Want to Learn More?
Discover more from Coursity
Subscribe to get the latest posts sent to your email.