CISA 1340: Linux Essentials
Chapter 2 Lab
INSTRUCTIONS:
Refer to Red Hat Academy page 2.5 and the session 2 lectures slides for help.
When a screenshot is requested, you must insert one as specified or you will not receive marks.
Submit this assignment into the Chapter 2 Lab dropbox before 11:30am, September 17, 2021.
Like any other written language, the Linux command line has a set of grammatical rules. This is what a typical command line looks like:
Every command line must begin with a command. Later in this course, you will learn that a command line can begin with other things such as aliases. For now, every command line starts with a command.
When reading documentation in comupting, square brackets usually indicate that what appears inside is optional. In a Linux command line, options (a.k.a. switches) and arguments are usually optional. It depends on the command that you are using.
This lab has you practice entering command lines that contain commands, options (a.k.a. switches), and arguments.
Log in on the classroom CentOS 7.9 VM as user root. The password is kickstart
Right-click on your Linux desktop and select Open Terminal to open a terminal window.
Create a user based on your actual first name and last initial by entering the following command line (enter means type it in and, then, press Enter). For example, if your name is Justin Trudeau, use justint
useradd firstnameLastInitial
Set your user’s password to cisa by entering the following command line. Note that when you enter the password, it does not appear and the cursor does not move. Ignore any warnings about cisa being a bad password.
passwd firstnameLastInitial
Log out the root user by clicking the power button near the top-right of your terminal window and, then, click the arrow next to root, and then select Log Out (DO NOT select Switch User):
Login as the user based on your actual first name and last initial.
Near the top-left of your terminal window, click Applications and, then, select System Tools, and Terminal to open a terminal window.
Enter the following command line (enter means type it in and, then, press Enter):
ls -l
(1 mark) What is the last piece of data that is output on every line?
ANSWER: The last piece of data that is output on every line is directories.
(1 mark) What is that output referred to as? (HINT: If you are not sure, use the man command to look at the documentation for the ls command and the -l switch by entering man ls)
ANSWER: -1 is list one file per line
(1 mark) Using a command from chapter 2, enter a command line that outputs only the first ten lines of a file named /etc/passwd and insert a screenshot, here, showing your command line and its output:
(1 mark) Using a command from chapter 2, enter a command line that uses a short command line option/switch that outputs only the last three lines of a file named /etc/passwd and insert a screenshot, here, showing your command line and its output:
(1 mark) Redo the previous step, but replace the short command line option/switch with a long command line/switch and insert a screenshot, here, showing your command line and its output:
(1 mark) Using a command from chapter 2, enter a command line that outputs the entire contents of a file named .bashrc and insert a screenshot, here, showing your command line and its output:
(1 mark) Using a technique from chapter 2, enter a command line that combines both the date and whoami commands together onto one command line and insert a screenshot, here, showing your command line and its output:
(1 mark) Using a command from chapter 2, enter a command line that outputs only the number of lines and the name of the file for the file named /etc/group and insert a screenshot, here, showing your command line and its output:
(1 mark) Using a technique from chapter 2, enter a command line that uses a special character to break the following command line into two lines and insert a screenshot, here, showing what you entered (NO output required, as it’s too long):
cat -A /usr/share/dict/words