Linux Command Line Quiz

AP Cybersecurity: Applying Commands in Real Scenarios

Welcome!

This quiz focuses on when and why to use a Linux command — not just what it’s called. Think like a cybersecurity analyst working at the command line.

Questions are related to the commands in the cyber.org Linux Commands Cheat Sheet.

Q1

You just SSH’d into an unfamiliar Linux server during an incident response. You want to see EVERY file in the current directory, including hidden dotfiles and their permissions. What do you run?

  • ls
  • ls -al
  • cd
  • pwd

Q2

You’ve been navigating through several nested directories investigating a compromised web app and have lost track of where you are. What command re-orients you?

  • pwd
  • ls -al
  • mkdir
  • history

Q3

You’re setting up a case folder to organize evidence for a forensics investigation. What command creates a new folder called case_2024_017?

  • mkdir case_2024_017
  • touch case_2024_017
  • cd case_2024_017
  • rm case_2024_017

Q4

A junior analyst is about to run rm -rf /var/log to “clean up disk space.” Why should you stop them?

  • It permanently deletes the entire logs directory and everything in it, destroying evidence and monitoring history
  • It only moves the logs to a recycle bin for later recovery
  • It just renames the log directory
  • It compresses the logs to save space

Q5

Before editing a critical configuration file like /etc/ssh/sshd_config, what’s the safest first step?

  • cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
  • rm /etc/ssh/sshd_config
  • chmod 000 /etc/ssh/sshd_config
  • kill -9 sshd_config

Q6

After investigating a suspicious script, you want to rename payload.txt to payload_ANALYZED.txt to mark it as reviewed. What command does this?

  • mv payload.txt payload_ANALYZED.txt
  • cp payload.txt payload_ANALYZED.txt
  • ln -s payload.txt payload_ANALYZED.txt
  • touch payload_ANALYZED.txt

Q7

Your team runs the same vulnerability scan script from /opt/tools/scan.sh constantly, but typing the full path each time is tedious. What’s a good solution?

  • ln -s /opt/tools/scan.sh ~/scan.sh
  • rm /opt/tools/scan.sh
  • chmod 000 /opt/tools/scan.sh
  • kill scan.sh

Q8

You constantly type ls -alh --color to review directories in detail. How can you save time going forward?

  • alias ll=‘ls -alh –color’
  • mkdir ll
  • cp ls ll
  • man ls

Q9

A log file auth.log is actively growing as a brute-force attack unfolds. You want to watch new login attempts appear in real time. Which approach fits best?

  • tail -f auth.log
  • head auth.log
  • rm auth.log
  • mkdir auth.log

Q10

You’ve received a massive 500,000-line log file and just want to quickly confirm the file starts with the expected header format before diving in. What command helps?

  • head file.log
  • cat file.log
  • tail file.log
  • wc file.log

Q11

You suspect an attacker’s IP address, 203.0.113.45, appears somewhere in a massive access.log file. How do you find every line mentioning it?

  • grep 203.0.113.45 access.log
  • head access.log
  • mkdir access.log
  • chmod access.log

Q12

You want to find every currently running process, then filter that list down to only show processes related to “python” (which might be running a malicious script). What’s the best approach?

  • ps aux | grep python
  • ps aux; grep python
  • top python
  • kill python

Q13

You want to keep a permanent copy of everything the ps aux command shows right now, saved to a file called process_snapshot.txt, for later comparison. What do you run?

  • ps aux > process_snapshot.txt
  • ps aux | process_snapshot.txt
  • cp ps aux process_snapshot.txt
  • grep ps aux process_snapshot.txt

Q14

You found a suspicious shell script, cleanup.sh, that won’t execute even though you have read access to it. What’s most likely needed?

  • chmod +x cleanup.sh
  • cat cleanup.sh
  • rm cleanup.sh
  • mv cleanup.sh cleanup.sh
  • alias cleanup.sh=‘run’

Q15

Your team is hardening a shared server. A sensitive configuration file is currently world-writable (anyone can edit it) — a major security risk. Which command tightens this so only the owner can read/write, and everyone else can only read?

  • chmod 644 config.txt
  • chmod 777 config.txt
  • chmod -w config.txt
  • rm config.txt

Q16

The server feels sluggish, and you suspect one process is eating up most of the CPU. What’s the fastest way to check which process is the culprit right now?

  • top
  • pwd
  • mkdir cpu_check
  • history

Q17

After identifying a malicious process (PID 4821) that won’t respond to a normal shutdown request, what should you run to force it to stop immediately?

  • kill -9 4821
  • kill 4821
  • rm 4821
  • chmod -x 4821

Q18

You copied an evidence file from a suspect’s account to your own investigation folder, but it’s still owned by the original user, blocking you from modifying it as needed. What fixes this?

  • chown analyst evidence_file.txt
  • chmod evidence_file.txt
  • mv evidence_file.txt
  • cat evidence_file.txt

Q19

You need to install a security patch, but the update command requires root-level access, and you’re logged in as a standard user. What do you prepend to the command?

  • sudo
  • alias
  • chown
  • grep

Q20

During a post-incident review, you want to see exactly which commands the attacker (or the compromised account) typed most recently on this system. What do you check?

  • history
  • top
  • wc
  • ln -s

Wrap-up

You’ve now practiced applying real Linux commands to real cybersecurity scenarios:

  • Investigating file systems and hidden data
  • Searching and monitoring logs for indicators of compromise
  • Managing permissions, ownership, and privilege escalation safely
  • Identifying and stopping malicious or unresponsive processes
  • Preserving evidence and reconstructing a command history