4.3 Tools of Network Analysts: Using the CLI
🌐AP Networking Unit 4 Review
4.3 Tools of Network Analysts: Using the CLI
🌐 AP Networking
4.1
What Happens When Networks Break or Fail?
4.2
The Language of the Network: Protocols and the OSI and TCP/IP Models
4.3
Tools of Network Analysts: Using the CLI
4.4
How Data Travel the Internet: Routing, Metrics, and Paths
4.5
From the Inside Out: Monitoring and Defending a Large Network
4.6
Moving Forward: Designing for Reliability and Growth
continue practicing 4.3
Multiple choice
If you've only ever clicked around a computer using icons and windows, the command line interface (CLI) can feel like stepping into a different world. Instead of pointing and clicking, you type commands as text and the system responds. Network analysts live in the CLI because it's fast, scriptable, and works on devices that don't even have a screen worth looking at. This guide walks through how to navigate systems with CLI commands and how to move files between machines securely.
Why Network Analysts Use the CLI
A graphical user interface (GUI) can feel more intuitive because you can see buttons, folders, and menus. But a command line interface (CLI) has real advantages that matter for network work:
- Automation and repetition. You can save a series of CLI commands in a script and run them again and again. Try automating a GUI by clicking in the exact same spot a thousand times. Not fun.
- Small footprint. A CLI uses less storage space and less processing power than a GUI. That leaves more resources for the user's actual tasks, apps, and files.
- Device compatibility. Many network devices (routers, switches, servers) only offer a CLI. There is no GUI option, so you have to know your way around.
That last point is big. If you're configuring a router in a server room, there's no desktop with pretty folders. It's you and a blinking cursor.
Reading a CLI Prompt
Before you type any command, you need to know how to read the prompt, which is the text the system shows to tell you it's ready for input.
Linux prompts
On Linux-based systems, file locations often start at the root directory, written as /. Every other folder is nested inside root. So a path like /home/user/Desktop means:
homesits inside/(root)usersits insidehomeDesktopsits insideuser
A typical Linux prompt looks like this:
</>Codeuser@hostname /home/user/Desktop $
A few things to notice:
- The
$at the end signals the prompt where you type your command. Many modern shells use this symbol. - The path shows your current location in the file system.
- The tilde (
~) is a shortcut for the current user's home directory. Souser@hostname ~ $means you're sitting in your own home folder.
Windows prompts
Command Prompt is the proprietary CLI for Windows. Its paths begin with a drive letter, then the nested directory names, like C:\Users\username\Desktop. Here:
Usersis inside theC:driveusernameis insideUsersDesktopis insideusername
A Windows prompt uses a right-angle bracket (>) after the path to show it's ready for input:
</>CodeC:\Users\user\Desktop>
Absolute vs. relative paths
A path like /home/user/Desktop is absolute because it starts from the root and tells the system exactly where to look. A path like Desktop by itself is relative, meaning it's interpreted from your current location. If you're already in /home/user, typing Desktop tells the system to look for Desktop inside /home/user.
CLI Command Syntax
Every CLI command follows a standard syntax pattern:
</>Codecommand options arguments
- Command: the name of the program you want to run (like
cdorls). - Options: optional parameters that change how the command behaves or what it shows. They're often marked with a dash (
-) and are also called switches or flags. - Arguments: specific info the command needs, like a file name or path. Some commands require arguments, others run fine without any.
The Linux ls command (which lists what a directory contains) shows all four combinations:
| Command | What it does |
|---|---|
ls | No options, no arguments. Lists the contents of your working directory, excluding hidden files. |
ls -a | Option -a shows everything in the working directory, hidden files and directories included. |
ls user1 | No options, with user1 as the argument. Shows what the user1 directory holds, excluding hidden files. |
ls -a user1 | Both the -a option and the user1 argument. Shows everything in user1, hidden files included. |
Navigating the File System
To get work done in a CLI, you need to do three basic things: move between directories, see what a directory contains, and figure out where you currently are.
Core navigation commands
| Command | System | What it does |
|---|---|---|
cd | Mac/Linux/Windows | Changes the working directory |
ls | Mac/Linux | Lists what a directory contains |
dir | Windows | Shows what a directory contains |
pwd | Mac/Linux | Prints the current working directory |
The ls vs dir split trips people up. On Mac or Linux, you list contents with ls. On Windows, the same job is done by dir.
Using cd to move around
The cd command (change directory) is the main way to move through a file system. A few useful versions:
cd subdirectory_name: moves you into a subdirectory of your current location.cd ..: moves you one level up, toward the root directory.cd ~: jumps to your home directory.cd /: jumps all the way to the root directory.
So if you're sitting in /home/user/Desktop and type cd .., you'll land in /home/user. Type it again and you're in /home. One more and you're at /.
Getting help with commands
When you forget how a command works (and you will), two commands bail you out:
help: gives a general overview of a command.man: short for "manual," gives detailed documentation on a command's options and usage.
Use help when you want a quick refresher. Use man when you need the full breakdown.
Moving Files Securely Between Systems
Network analysts don't just manage one machine. They often need to transfer files between devices, and those transfers need to be secure. The CLI handles this through two related protocols.
SSH: the secure foundation
Secure Shell (SSH) is a CLI protocol for connecting securely to remote systems. The key word is secure. SSH encrypts all data that travels in either direction between you and the remote device. That means anyone snooping on the network just sees scrambled gibberish.
SFTP: secure file transfer built on SSH
Secure File Transfer Protocol (SFTP) is one option for moving data between devices. SFTP relies on SSH to set up the secure connection, so every bit of data (login credentials included) stays encrypted during the transfer.
Both SSH and SFTP operate on port 22. If someone asks what port SFTP uses, the answer is the same as SSH: 22.
Starting an SFTP session
To open an SFTP session, you connect to the remote host with this command:
</>Codesftp <remote_username>@<remote_hostname_or_IP_address>
For example:
</>Codesftp panda@192.168.1.15
This tries to reach user panda on the device at IP address 192.168.1.15. The connection isn't complete until you supply valid credentials. For security, the password stays invisible as you type it. No asterisks, no dots, nothing. That's normal, not a bug.
Navigating inside an SFTP session
Once you're connected, you can move around the remote device using commands that look just like the local ones:
ls: shows what the current remote directory contains.cd: switches to a different remote directory.pwd: displays which remote directory you're currently in.
The commands feel familiar, but remember they're acting on the remote device now, not your local machine.
Transferring files with get and put
The two main commands for moving files during an SFTP session:
get filename: downloads a file from the remote device to your local device.put filename: uploads a file from your local device to the remote device.
An easy way to keep them straight: you get things from the remote server (remote to local), and you put things onto the remote server (local to remote).
So if you're connected to a web server and want to grab a log file to analyze locally, you'd use get server.log. If you want to upload a new config file, you'd use put new_config.txt.
Practice Questions for 4.3
1 of 10
An administrator must securely upload a critical security patch (patch.bin) from their local machine to a specific folder (/updates) on a remote server (192.168.5.5). Uploading to the wrong folder or using an unencrypted protocol could compromise the server. Which sequence of CLI commands provides the most comprehensive mitigation by securing the session, navigating to the correct folder, and uploading the file?
A.
Connect via sftp 192.168.5.5@admin, navigate using ls /updates, and upload using put patch.bin.
B.
Connect via sftp admin@192.168.5.5, navigate using cd /updates, and upload using put patch.bin.
C.
Connect via sftp admin@192.168.5.5, navigate using cd /updates, and upload using get patch.bin.
D.
Connect via sftp 192.168.5.5@admin, navigate using ls /updates, and upload using get patch.bin.
Vocabulary
The following words are mentioned explicitly in the AP® course framework for this topic.Term | Definition |
|---|---|
cd | An SFTP command that switches to a different remote directory. |
Command Line Interface | A text-based environment in which users type commands to perform tasks such as system management and file transfers. |
encryption | The process of converting data into a coded form so that only authorized parties with the proper key can read it. |
get filename | An SFTP command that downloads a file from the remote device to the local device. |
login credentials | The username and password used to access a device's configuration or management interface. |
ls | An SFTP command that shows the contents of the present remote directory. |
port 22 | The network port used by both SSH and SFTP for their connections. |
put filename | An SFTP command that uploads a file from the local device to the remote device. |
pwd | An SFTP command that displays the current remote working directory. |
remote host | The target device or system that a user connects to over a network, identified by a hostname or IP address. |
Secure File Transfer Protocol | A method for moving data between devices that relies on SSH to set up a secure, encrypted connection during transfer. |
Secure Shell | A CLI protocol for connecting securely to remote systems, encrypting all data sent in either direction between user and remote device. |
SFTP session | An interactive connection to a remote device opened with the sftp command, within which file navigation and transfer commands are used. |
See Fiveable more often in Google
Mark Fiveable as a preferred source and Google is more likely to show you our guides in Top Stories, with a "preferred" badge in AI Mode and AI Overviews.