Lab Comprehensive 1 : Managing Files From The Command Line
In this review, you will manage files, redirect a specific set of lines from a text file to another
file and edit the text files.
##OUTCOMES
You should be able to:
• Manage files from the command line.
• Display a certain number of lines from text files and redirect the output to another file.
• Edit text files.
##BEFORE YOU BEGIN
Copy any files or work you wish to keep to other systems before resetting. Reset the
workstation, servera, and serverb systems now. Wait until the workstation,
servera, and serverb systems are started.
Log in to workstation as student using student as the password.
On workstation, run lab rhcsa-rh124-review1 start to start the comprehensive
review. This script creates the necessary files to set up the environment correctly.
[student@workstation ~]$ lab rhcsa-rh124-review1 start
##INSTRUCTIONS
Accomplish the following tasks on serverb to complete the exercise.
• Create a new directory called /home/student/grading.
• Create three empty files in the /home/student/grading directory named grade1,
grade2, and grade3.
• Capture the first five lines of the /home/student/bin/manage-files file in the /
home/student/grading/manage-files.txt file.
• Append the last three lines of /home/student/bin/manage-files to the file /home/
student/grading/manage-files.txt. You must not overwrite any text already in the
file /home/student/grading/manage-files.txt.
• Copy /home/student/grading/manage-files.txt to /home/student/grading/
manage-files-copy.txt.
• Edit the file /home/student/grading/manage-files-copy.txt so that there
should be two sequential lines of text reading Test JJ.
• Edit the file /home/student/grading/manage-files-copy.txt so that the Test
HH line of text must not exist in the file.
• Edit the file /home/student/grading/manage-files-copy.txt so that the line A
new line should exist between the line reading Test BB and the line reading Test CC.
• Create a hard link named /home/student/hardlink to the file /home/student/
grading/grade1. You will need to do this after creating the empty file /home/
student/grading/grade1 as specified above.
• Create a soft link named /home/student/softlink to the file /home/student/
grading/grade2.
• Save the output of a command that lists the contents of the /boot directory to the file
/home/student/grading/longlisting.txt. The output should be a “long listing”
that includes file permissions, owner and group owner, size, and modification date of each
file.
##Evaluation
On workstation, run the lab rhcsa-rh124-review1 grade command to confirm success
of this exercise.
[student@workstation ~]$ lab rhcsa-rh124-review1 grade
##Finish
On workstation, run lab rhcsa-rh124-review1 finish to complete the comprehensive
review. This script deletes the files and directories created during the start of the comprehensive review and ensures that the environment on serverb is clean.
[student@workstation ~]$ lab rhcsa-rh124-review1 finish
This concludes the comprehensive review.