0% found this document useful (0 votes)
4 views1 page

Compressing and Viewing Files in Linux

This document outlines a lab exercise for the LPIC-1 Exam 1 (101-500) by Christine Bresnahan, recommending the use of CentOS 7 or Ubuntu Desktop 18.04LTS. It provides step-by-step instructions for users to practice various Linux commands related to file management, compression, and archiving. The lab emphasizes the importance of having the necessary permissions and prior knowledge from earlier sections to successfully complete the tasks.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Compressing and Viewing Files in Linux

This document outlines a lab exercise for the LPIC-1 Exam 1 (101-500) by Christine Bresnahan, recommending the use of CentOS 7 or Ubuntu Desktop 18.04LTS. It provides step-by-step instructions for users to practice various Linux commands related to file management, compression, and archiving. The lab emphasizes the importance of having the necessary permissions and prior knowledge from earlier sections to successfully complete the tasks.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Section 8 Lab

LPIC-1, Exam 1 (101-500)


By Christine Bresnahan
Recommended Linux Distributions for this exercise:
• CentOS version 7
• Ubuntu Desktop 18.04LTS

Note: For a successful lab session, it is assumed you are using the recommended Linux distribution(s) and
the recommended version, and that your Linux systems are booted. In addition, it is assumed that you can log
into the system as a standard user as well as either the root account or a user with super user privileges. Also,
you should have successfully completed the prior sections’ labs and sessions & viewed this section's videos.

Follow these actions to explore concepts and commands covered in this section (but please feel free to
explore as much as you want. And don’t forget that you can get help on the usage of these commands
through the man pages. Type in man and follow it with the utility name, then press Enter to view
information on the utility):
1. Log into either your Ubuntu or CentOS distro tty2 terminal, using the username and password you
created when you installed the system.
2. Copy over a log file to use in your home directory for this lab by typing cp /var/log/wtmp file1 and
pressing Enter. (If the /var/log/wtmp file does not exist, pick another log file you can copy over to your
home directory without super user privileges).
3. Make a second copy of the log file to use in your home directory for this lab by typing
cp /var/log/wtmp file2 and pressing Enter.
4. Make a third and final copy of the log file to use in your home directory for this lab by typing
cp /var/log/wtmp file3 and pressing Enter.
5. Try compressing a file with gzip, by typing gzip file1 and pressing Enter.
6. Try compressing a file with bzip2, by typing bzip2 file2 and pressing Enter.
7. Try compressing a file with xz, by typing xz file3 and pressing Enter.
8. Compare the compressed file sizes by typing ls -l file?.* and pressing Enter.
9. View the gzip compressed file, by typing zcat [Link] and pressing Enter.
10. View the bzip2 compressed file, by typing bzcat file2.bz2 and pressing Enter.
11. View the xz compressed file, by typing xzcat [Link] and pressing Enter.
12. Attempt to decompress each of the files, using the appropriate utilities: either gunzip, bunzip2, or unxz.
13. If you did not do the previous step, copy over more log files to use by repeating this lab's steps #2-4.
14. Create a tar archive of the log files, by typing tar -cvf [Link] file? and pressing Enter.
15. View a long listing of the tar archive by typing ls -l [Link] and pressing Enter.
16. Peek inside the tar archive by typing tar -tf [Link] and pressing Enter.
17. Extract the files from the tar archive, by typing tar -xvf [Link] and pressing Enter.
18. Create a tarball of the log files, by typing tar -Jcvf [Link] file? and pressing Enter.
19. View a long listing of the tar archive by typing ls -l [Link] and pressing Enter.
20. Extract the files from the tarball, by typing tar -Jxvf [Link] and pressing Enter.
21. Create a cpio archive of the log files, by typing ls file? | cpio -ov > [Link] and pressing Enter.
22. Peek inside the cpio archive, by typing cpio -itvI [Link] and pressing Enter.
23. Create a new subdirectory in your home directory, by typing mkdir logFiles and pressing Enter.
24. Move the cpio archive into the new logFiles directory.
25. Change your present working directory into the new logFiles directory.
26. Extract the files from the cpio archive, by typing cpio -iv --no-absolute-filenames -I [Link] and
pressing Enter.
27. Use the list command to make sure the files were extracted.
28. Change your present working directory back to your home directory.
29. Remove the logFiles directory and its contents.
30. Remove any log files and/or archive files created in this lab from your home directory, if desired.

You might also like