(Fundamentals of Cyber) (System Administration) (09) Lab - Navigating With The CLI (Student)
(Fundamentals of Cyber) (System Administration) (09) Lab - Navigating With The CLI (Student)
Discussion:
Unlike a GUI (graphical user interface), a CLI, or command line interface, processes user
commands in the forms of lines and text. Being able to operate a device’s CLI facilitates
troubleshooting and provides insight into the device’s settings and configuration. Therefore,
knowing how to use command line interfaces is essential for careers such as network
administrators, data engineers, IT specialists, and many more.
Exercise:
Master some of the basics of using your device’s CLI by completing the following tasks!
Set Up
1. Create a folder on your desktop titled CLI Practice
2. Put 2-5 files into this folder. These can be images or documents that already exist, or you
can create new files.
3. Based on your OS, follow the steps below:
Mac: Terminal
1. Start by opening the Terminal app. There are three ways to get there:
● Click the Launchpad icon in the Dock, type Terminal in the search field, then
click Terminal.
2. When you first open Terminal, you are automatically placed in the current user’s (you!)
home folder. This is denoted using the shortcut ~ . Let’s start by seeing what folders are
within this home folder by using the ls (or list) command. This should show you all of the
folders in your home folder.
3. Navigate to the Desktop folder. To do this, we will use the cd (change directory)
command. Type the command cd Desktop, then press Return. You will know you are in
the Desktop folder when you see Desktop instead of ~ in the prompt. This means that you
are now in the Desktop folder instead of your home folder.
4. Take a peek inside the Desktop folder to see what other folders and files there are. To do
this, we’ll use the ls command again. Check the list that is pulled with the files you can
see on your desktop.
1
5. Navigate to the CLI Practice folder. We’ll use the cd command again because we are
changing folders. Note that because this folder name has a space, we will need to place
the folder name in single quotation marks: cd ‘CLI Practice’
6. Look inside the folder to see what files are there. To do this, what command will you use?
7. Open the files in the CLI Practice folder by using the open command. Type open, then
space, and then the file name. Note that the file name must be exact! Also, remember to
use single quotation marks if your file name has spaces.
8. Navigate back to your home folder by typing the cd command without specifying a
directory. How will you know if you’re in your home folder?
9. Continue practicing using Terminal by exploring other folders and opening files! Try using
the cd.. command to navigate to the directory above the one you’re currently in.
2
1. Start by opening the Command Prompt app. There are three ways to get there:
● Use the search bar at the bottom of the screen and type “Command Prompt”
● Go to Start → scroll to Windows System → click Command Prompt
2. When you first open Command Prompt, you are automatically placed in the current user’s
(you!) home folder. Let’s start by seeing what is within this home folder by using the dir
(or directory) command. This should show you all of the folders in your home folder.
3. Navigate to the Desktop folder. To do this, we will use the cd (change directory)
command. Type the command cd Desktop, then press Return. You will know you are in
the Desktop folder when you see \Desktop added after your username. This means that
you are now in the Desktop folder instead of your home folder.
a. Note: Windows 10 defaults to saving files on OneDrive. Due to this, you may need
to navigate first to the OneDrive folder and then again to the Desktop folder, using
the cd command both times.
4. Take a peek inside the Desktop folder to see what other folders and files there are. To do
this, we’ll use the dir command again. Check the list that is pulled against the files you
can see on your desktop.
5. Navigate to the CLI Practice folder. We’ll use the cd command again because we are
changing folders. Note that case does not matter in Command Prompt.
6. Look inside the folder to see what files are there. To do this, what command will you use?
It’s blocked
7. Open the files in the CLI Practice folder by simply typing the entire name of the file
(including the extension) surrounded by double quotation marks.
8. Navigate back to your home folder by using the cd.. (that is two periods). This command
will take you back to the directory above the one you are currently in. Keep using this
command until you are back in your user folder. How will you know when you are there?
It’s blocked
9. Continue practicing using Terminal by exploring other folders and opening files!