4.2.7 Lab - Getting Familiar With The Linux Shell - ILM
4.2.7 Lab - Getting Familiar With The Linux Shell - ILM
Introduction
In this lab, you will use the Linux command line to manage files and folders, and perform some basic
administrative tasks.
Part 1: Shell Basics
Part 2: Copying, Deleting, and Moving Files
Recommended Equipment
CyberOps Workstation virtual machine
NB: This lab can be done using the virtual machine created in a previous lab.
Instructions
2018 - 2024 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 1 of 9 www.netacad.com
Lab - Getting Familiar with the Linux Shell
A few sections in a man page are: Name, Synopsis, Configuration, Description, Options, Exit
status, Return value, Errors, Environment, Files, Versions, Conforming to, Notes, Bugs, Example,
Authors, and See also.
b. Type q to exit the man page.
c. Use the man command to learn more about the cp command:
[analyst@secOps ~]$ man cp
Question:
Copy files from one location to another location in the local filesystem.
What command would you use to find out more information about the pwd command? What is the
function of the pwd command?
Type your answers here.
The man pwd command is used to access the man page about pwd. The pwd command prints the
name of the current or working directory.
2018 - 2024 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 2 of 9 www.netacad.com
Lab - Getting Familiar with the Linux Shell
The directory is changed to the home directory. Because the shell interprets the ~ as a shortcut
for the current user’s home directory, cd ~ changes to the current user’s home.
g. Use the mkdir command to create a new folder named cyops_folder4 inside the cyops_folder3 folder:
[analyst@secOps ~]$ mkdir /home/analyst/cyops_folder3/cyops_folder4
[analyst@secOps ~]$
h. Use the ls -l command to verify the folder creation.
analyst@secOps ~]$ ls –l /home/analyst/cyops_folder3
2018 - 2024 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 3 of 9 www.netacad.com
Lab - Getting Familiar with the Linux Shell
total 4
drwxr-xr-x 2 analyst analyst 4096 Aug 16 15:04 cyops_folder4
i. Up to this point, we have been using full or absolute paths. Absolute path is the term used when referring
to paths that always start at the root (/) directory. It is also possible to work with relative paths. Relative
paths reduce the amount of text to be typed. To understand relative paths, we must understand the . and
.. (dot and double dot) directories. From the cyops_folder3 directory, issue a ls –la:
analyst@secOps ~]$ ls –la /home/analyst/cyops_folder3
total 12
drwxr-xr-x 3 analyst analyst 4096 Aug 16 15:04 .
drwxr-xr-x 20 analyst analyst 4096 Aug 16 15:02 ..
drwxr-xr-x 2 analyst analyst 4096 Aug 16 15:04 cyops_folder4
The -a option tells ls to show all files. Notice the . and .. listings shown by ls. These listings are used by
the operating system to track the current directory (.) and the parent directory (..) You can see the use of
the . and .. when using the cd command to change directories. Using the cd command to change the
directory to the . directory incurs no visible directory change as the . points to the current directory itself.
j. Change the current directory to /home/analyst/cyops_folder3:
[analyst@secOps ~]$ cd /home/analyst/cyops_folder3
[analyst@secOps cyops_folder3]$
k. Type cd .
[analyst@secOps cyops_folder3]$ cd .
[analyst@secOps cyops_folder3]$
Question:
What happens?
Type your answers here.
Apparently nothing but the command interpreter has changed the directory to the current
directory itself.
l. Changing the directory to the .. directory, will change to the directory that is one level up. This directory is
also known as parent directory. Type cd ..
[analyst@secOps cyops_folder3]$ cd ..
[analyst@secOps ~]$
Question:
What happens?
Type your answers here.
The directory was changed to /home/analyst, which is the directory immediately above
cyops_folder3, also known as parent directory.
What would be the current directory if you issued the cd .. command at [analyst@secOps ~]$?
Type your answers here.
/home
What would be the current directory if you issued the cd .. command at [analyst@secOps home]$?
Type your answers here.
2018 - 2024 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 4 of 9 www.netacad.com
Lab - Getting Familiar with the Linux Shell
What would be the current directory if you issued the cd .. command at [analyst@secOps /]$?
Type your answers here.
/ (backslash), the root of the filesystem. Because this is the highest level, no upward change is
done as the root directory has no parent directory.
2018 - 2024 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 5 of 9 www.netacad.com
Lab - Getting Familiar with the Linux Shell
The text file was completely replaced by the new message. The > operator destroyed the contents
of the txt file before writing the message echoed by echo.
The new message was appended to the end of the file, keeping the original contents intact.
Answer may vary based on the user’s prior lab activities and interactions in the CyberOps
Workstation VM. Make sure to also count the directories (displayed by ls in blue).
c. Use the ls -la command to display all files in the home directory of analyst, including the hidden files.
[analyst@secOps ~]$ ls –la
Questions:
Many more as ls -la displays, in addition to regular files, all the hidden files in folder.
Is it possible to hide entire directories by adding a dot before its name as well? Are there any directories
in the output of ls -la above?
Type your answers here.
2018 - 2024 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 6 of 9 www.netacad.com
Lab - Getting Familiar with the Linux Shell
Give three examples of hidden files shown in the output of ls -la above.
Type your answers here.
What are the source and destination files? (use full paths to represent the parameters)
Type your answers here.
2018 - 2024 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 7 of 9 www.netacad.com
Lab - Getting Familiar with the Linux Shell
2018 - 2024 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 8 of 9 www.netacad.com
Lab - Getting Familiar with the Linux Shell
rm -r cyops_folder2/
Reflection
What are the advantages of using the Linux command line?
Type your answers here.
Answers may vary. The command line allows the users more options and control over the graphical
interface. As the users become more experienced with the command line, the users may combine
these commands in scripts to perform routine tasks. The command line interface uses fewer
resources when users administrate the computers remotely.
End of document
2018 - 2024 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 9 of 9 www.netacad.com