1.7 KiB
1.7 KiB
Linux+ 1.6.1: Archives and compression
tar archives, restoring one file, gzip, bzip2 and xz side by side, reading a compressed log, and cpio.
Before you start
The lab clears away the files the tasks create in /tmp, if they're there.
Ubuntu empties /tmp at boot, so do the tasks without a reboot, and run
le-lab check before the chapter's clean-up step (le-lab reset cleans up
too, and removes bzip2 again if it wasn't installed when the lab
started). Tasks 2 and 3 ask for findings: write them to the files in
/root/lab-answers/ that they name.
Tasks
- Archive
/etcinto/tmp/etc.tar.gzwith gzip, list it to findsshd_config, and restore justetc/ssh/sshd_configfrom it into/tmp/restore. - Install
bzip2if it's missing (it often is). Archive/etcwithout compression into/tmp/etc.tar. Copy it to/tmp/t-gzip.tar,/tmp/t-bzip2.tarand/tmp/t-xz.tar, and compress each with the tool it's named after, keeping the copies. Write the name of the tool that made the smallest file to/root/lab-answers/2. - Save the last 500 lines of the journal, compressed with gzip, as
/tmp/j.gz. Without unpacking it, count the lines that mentionerrorin any case, and write the count to/root/lab-answers/3. - From
/etc, make a cpio archive of the files insshas/tmp/ssh.cpio, and unpack it into/tmp/c.
Hints
tar -czf,tar -tzf,tar -xzf ARCHIVE -C DIR MEMBER.dnf install bzip2orapt install bzip2.gzip -k,bzip2 -k,xz -k;ls -lh /tmp/t-*. The tools skip a file whose name already ends in their own suffix (.gz,.bz2,.xz).journalctl -n 500 --no-pager | gzip > ...;zgrep -c -i,zless.cd /etc && find ssh -type f | cpio -o > ...;cpio -idv < ....