AP Networking 4.3: Tools of Network Analysts, Using the CLI

AP Networking 4.3: Tools of Network Analysts: Using the CLI

The command line interface (CLI) is where real network work happens: navigating with cd, ls, and pwd, managing files with mkdir, mv, and cp, and moving data securely with SSH, SFTP, and scp. Learn to read any prompt and pick the right command every time.

Picture the Unit 4 scenario: a busy Saturday at the grocery store, prices displaying wrong, and the corrected price file sitting on an inventory server with no monitor and no desktop, only a shell prompt reachable over the network. Read the prompt, walk the directory tree, push one file over an encrypted connection, and you fix the store.

Why network analysts use the CLI

A graphical interface is friendlier for everyday use, so why the text terminal? Two reasons, and both are on the exam. First, the CLI makes automation and repetition simple: a command you can type is a command you can script, schedule, and rerun on fifty machines. Second, many network devices only have a CLI. A router or rack server skips the desktop because graphics take storage and processing power; stripping the GUI leaves those resources free for the device's real job. The CLI is often the only way in, and once you know a dozen commands it is usually the fast way too.

How to read a prompt (Linux and Windows)

Before typing anything, read what the shell is telling you. A Linux prompt packs three facts into one line:

intern@store-srv:~/reports$ _

That says: you are the user intern, on the machine store-srv, standing in ~/reports, and the dollar sign $ means the shell is ready for input. Linux paths begin at the root directory, /, and nest downward: in /home/intern/reports, home lives in the root, intern in home, and reports in intern. The tilde ~ is shorthand for your home directory, so ~/reports and /home/intern/reports name the same place.

Windows Command Prompt says the same things with different symbols: the working directory starts with a drive letter, and the right angle bracket means ready.

C:\Users\intern\Desktop> _

One more distinction the exam loves: an absolute path like /home/intern/reports spells out the full route from the root; a relative path like reports is resolved against wherever you stand, which is why analysts run pwd before anything destructive.

Command, options, arguments

Every command line follows one syntax pattern: command, options, arguments. The command names the program, like cd or ls. Options, usually marked with a dash and also called switches or flags, modify how the command behaves. Arguments tell the command what to act on, such as a file or path. Here is the pattern with ls:

You type What happens Why
ls Lists the working directory, hidden files excluded No option, no argument; the working directory is the default
ls -a Same listing, hidden files included The -a option changes the behavior
ls reports Lists the reports directory The argument points ls somewhere else
ls -a reports Lists reports, hidden files included Option and argument together

Four commands cover almost all navigation. cd changes your working directory. ls lists a directory's contents on Mac and Linux; dir is the Windows equivalent. pwd prints the working directory when you lose track. And cd has four moves worth memorizing cold:

Command Where it takes you
cd reports Into the subdirectory named reports, inside your current location
cd .. Up exactly one level, toward the root
cd ~ Straight to your home directory, from anywhere
cd / Straight to the root directory, from anywhere
Watch the difference: cd .. climbs one step; cd / teleports to the top. From /home/intern/reports/backups, the first lands you in reports and the second in /.

Managing files: mkdir, mv, cp, cat

Navigation gets you to the file; these four do something with it. mkdir backups creates a directory named backups. mv prices-old.csv backups moves the file into backups; with a new name as the second argument, the same command renames. cp prices.csv backups copies the file, leaving the original in place. cat outage-notes.txt prints a file's contents to the terminal, the quickest way to read a short log file.

The pair to keep straight: mv relocates, cp duplicates. Backing up the price file is cp; clearing the stale file out of the working directory is mv.

When you are stuck: help and man

Nobody memorizes every flag of every command. Two commands describe the others: help gives a quick overview, and man (short for manual) opens the full documentation page with every option and usage pattern. Running man ls is how an analyst discovers that -a means all.

Secure transfers: SSH, SFTP, and scp

Now the security-first half. Anything sent in plain text can be read in transit, credentials included, so transfers must be encrypted. Secure Shell (SSH) connects to a remote system and encrypts everything exchanged in both directions. Secure File Transfer Protocol (SFTP) runs on top of SSH, so the entire transfer, credentials and data, is encrypted end to end. Both use port 22.

An SFTP session starts with the pattern sftp username@host:

intern@laptop:~$ sftp [email protected]
[email protected]'s password:
Connected to 192.168.50.10.
sftp> pwd
Remote working directory: /srv/exports
sftp> ls
corrected-prices.csv   exports.log
sftp> get corrected-prices.csv
Fetching /srv/exports/corrected-prices.csv to corrected-prices.csv
sftp> put fixed-prices.csv
Uploading fixed-prices.csv to /srv/exports/fixed-prices.csv

Every line of that transcript is testable. Nothing appears while the password is typed; that is a deliberate security feature, not a frozen terminal. Inside the session, ls, cd, and pwd operate on the remote directory. Two commands do the transfers: get filename downloads from the remote device, and put filename uploads to it. Down is get, up is put.

When one file needs to move and no session is required, scp copies over SSH in a single command: scp fixed-prices.csv [email protected]:/srv/exports, encrypted the whole way.

A full worked walkthrough

Here is the whole topic in one Saturday fix. The shelf displays are pulling from a stale price file; the corrected one waits on the inventory server.

intern@store-srv:~$ ls
reports  tools
intern@store-srv:~$ cd reports
intern@store-srv:~/reports$ ls -a
.  ..  .audit.log  prices-old.csv  prices.csv  saturday-sales.csv
intern@store-srv:~/reports$ mkdir backups
intern@store-srv:~/reports$ cp prices.csv backups
intern@store-srv:~/reports$ mv prices-old.csv backups
intern@store-srv:~/reports$ sftp [email protected]
[email protected]'s password:
sftp> cd /srv/exports
sftp> get corrected-prices.csv
sftp> put saturday-sales.csv
sftp> exit
intern@store-srv:~/reports$ pwd
/home/intern/reports

Beat by beat: look around with ls, enter with cd, reveal the hidden audit log with ls -a, create a safety net with mkdir and cp, clear the stale file with mv, then open an SFTP session to pull the corrected prices down and push the sales report up. The final pwd confirms location. Every byte that left the machine was encrypted.

Practice: Terminal Trainer

Now sit at the simulated prompt. Each case shows a prompt, a file tree or session context, and a task; pick the one command line that does it. The wrong options are real commands for neighboring tasks, and cases and choices are shuffled every run, so read the evidence rather than memorize positions.

AP Networking - Unit 4 - Topic 4.3

Terminal Trainer

Read the prompt and the file tree, then type-by-choosing: pick the one command line that does the task. Every wrong option is a real command for a different job.

Case 1

Which command line does the task?

Score: 0 / 0

AP is a trademark of the College Board, which was not involved in the production of, and does not endorse, this resource.

Free sample questions

Try these the way the quiz asks them: read the artifact line, commit to an answer, then reveal.

1. The prompt reads intern@store-srv:/var/log$ and you want your home directory. Which command?

Answer: cd ~. The tilde stands for the home directory (EK 4.3.A.2, 4.3.A.6). cd / goes to the root and cd .. only up to /var.

2. In the command ls -a reports, what are -a and reports?

Answer: -a is an option (a flag changing behavior, here including hidden files) and reports is the argument, the directory being listed (EK 4.3.A.4).

3. Inside an sftp session, which command uploads fixed-prices.csv to the server?

Answer: put fixed-prices.csv. Put uploads from local to remote; get downloads (EK 4.3.B.5).

Key terms

CLI (command line interface)
A text interface operated by typed commands. Lighter than a GUI, built for automation.
Root directory
The top of a Linux file system, written /. Every path starts there.
Home directory
The current user's own directory, shortened to ~ in prompts and paths.
Working directory
Where you are standing now; pwd prints it, relative paths resolve against it.
Option (flag, switch)
A dash-marked modifier that changes a command's behavior, like the -a in ls -a.
Argument
The file or path a command acts on, like reports in ls reports.
SSH (Secure Shell)
Encrypted remote connection from the CLI. Port 22.
SFTP (Secure File Transfer Protocol)
File transfer over SSH, credentials and data encrypted. Port 22. get downloads, put uploads.
scp
A one-command encrypted copy over SSH, no interactive session needed.
PREMIUM

Full quiz, saved progress, and every Terminal Trainer case

Unlock the full 8-question quiz, the graded Terminal Trainer, and saved progress that reports to your class gradebook. Ad-free.

Get AP Networking premium

Frequently asked questions

What is a CLI and why do network devices use one?

A CLI is a text interface where you type commands instead of clicking. It supports automation, and it needs far less storage and processing than a GUI, so many routers and servers ship with only a CLI.

What does the tilde (~) mean in a Linux prompt?

The tilde is shorthand for the current user's home directory. A prompt ending in ~$ means the shell is ready for input there.

What is the difference between cd .. and cd /?

cd .. moves up exactly one level; cd / jumps to the root from anywhere. From /home/intern/reports, cd .. lands in /home/intern while cd / lands in /.

What is the difference between ls and ls -a?

Plain ls lists a directory without hidden files; the -a option includes them. On Windows, dir plays the role of ls.

What is an absolute path versus a relative path?

An absolute path names the full route from the root, like /home/intern/reports. A relative path like reports is resolved against your working directory, so it points to different places from different locations.

What port do SSH and SFTP use?

Both use port 22. SFTP runs on top of SSH, which is why they share it and why the whole transfer, login included, is encrypted.

Why does nothing appear when I type my password in an SFTP session?

That is a deliberate security feature, not a frozen terminal. The characters are read but never displayed. Type the password and press Enter.

What is the difference between get and put in SFTP?

get downloads a file from the remote device to your local machine; put uploads from local to remote. Down is get, up is put.

Is scp secure, and when would I use it instead of sftp?

Yes, scp copies files over SSH, encrypted like SFTP. Use scp to move one file in one command; use sftp when you want to browse the remote directories first.

How do I find out what a command's options mean?

Use help for a quick overview or man for the full manual page. man ls documents every option ls accepts, including -a.

AP is a trademark of the College Board, which was not involved in the production of, and does not endorse, this resource.

Get in Touch

Whether you're a student, parent, or teacher — I'd love to hear from you.

Just want free AP CS resources?

Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.

Typically responds within 24 hours

Message Sent!

Thanks for reaching out. I'll get back to you within 24 hours.

🏫 Welcome, fellow educator!

I offer curriculum resources, practice materials, and study guides designed for AP CS teachers. Let me know what you're looking for — whether it's classroom materials, a guest speaker, or Teachers Pay Teachers resources.

Email

[email protected]

📚

Courses

AP CSA, CSP, & Cybersecurity

Response Time

Within 24 hours

Prefer email? Reach me directly at [email protected]