CyberPatriot Resources · Resource 07

Linux Commands & Manual Pages

Build the habit of checking Linux documentation before using unfamiliar commands, options, configuration files, or system administration tools.

Linux commands can be extremely precise, but a single option can also expand a change across an entire system. Manual pages help you understand syntax, scope, files, side effects, and related tools.

Command reference rule

Never guess a high-impact option

If a flag changes files recursively, removes data, alters permissions, disables services, or modifies firewall state, check its documentation before running it.

Official references

Understanding manual sections

Section 1

User Commands

Commands normally used directly from a shell by users and administrators.

Examples: ls, cat, grep, find, ps, ssh

Section 2

System Calls

Interfaces programs use to request services from the Linux kernel.

Examples: open, read, write, fork

Section 3

Library Functions

Functions provided by programming libraries.

Examples: printf, malloc

Section 4

Devices

Special files and device interfaces.

Examples: /dev entries

Section 5

File Formats

Configuration-file formats and structured system files.

Examples: passwd, shadow, sudoers

Section 7

Miscellaneous

Standards, protocols, concepts, and general system information.

Examples: protocols and conventions

Section 8

Administration

System administration and privileged management commands.

Examples: useradd, ip, mount

Finding the right documentation

man command

man systemctl

Open the primary manual page for a command.

Specific manual section

man 5 passwd

Open a specific manual section when a name exists in multiple sections.

Keyword search

man -k password

Search manual-page names and descriptions for a keyword.

Short description

whatis chmod

Display the one-line manual description for a known command.

Built-in help

command --help

Quickly review syntax and common options without leaving the terminal.

Shell help

help cd

Use shell-provided help for commands implemented as shell built-ins.

Command groups worth knowing

Identity & Privilege

id

Display UID, GID, and group membership.

who

Show logged-in users.

w

Show logged-in users and their activity.

getent passwd

Query account information through system databases.

getent group

Query group information.

sudo -l

Show sudo permissions available to the current user.

Processes & Services

ps aux

Review running processes.

pstree -ap

Show process parent-child relationships.

systemctl

Inspect and manage systemd units.

systemctl status NAME

Review a specific service.

systemctl list-unit-files

Review configured unit startup states.

journalctl -u NAME

View journal entries for a service.

Files & Permissions

ls -la

Review files, ownership, and permissions.

stat FILE

Display detailed file metadata.

find

Search using path, owner, permission, time, and other criteria.

chmod

Change permission bits.

chown

Change file ownership.

readlink

Resolve symbolic-link targets.

Networking

ip addr

Review interface addressing.

ip route

Review routing state.

ss -tulpn

Review listening TCP and UDP sockets.

ping

Test basic network reachability.

traceroute

Observe the path toward a destination when installed.

ufw status verbose

Review UFW firewall state and rules.

Logs & Text Analysis

journalctl

Query the systemd journal.

grep

Search text using patterns.

head

Display the beginning of a file.

tail

Display the end of a file.

less

Read long output interactively.

sort | uniq

Group and count repeated text values.

Packages & System State

dpkg -l

List Debian packages known to the system.

apt list --installed

Review installed APT packages.

uname -a

Display kernel and system information.

hostnamectl

Review hostname and operating-system information.

df -h

Review mounted filesystem space.

lsblk

Review block devices and mount relationships.

How to read a manual page

01

Read the SYNOPSIS to understand required argument order.

02

Check DESCRIPTION before copying an example.

03

Review OPTIONS for scope-changing flags such as recursive or force.

04

Check FILES to learn which configuration files the command uses.

05

Review EXIT STATUS when troubleshooting scripts or failed commands.

06

Read EXAMPLES only after understanding the command's purpose.

07

Check SEE ALSO for related utilities and configuration references.

08

Confirm whether the documentation matches the installed distribution and command version.

Competition reference situations

You remember the command but not the option

1

Do not guess a destructive or scope-changing flag.

2

Open the manual page or --help output.

3

Find the exact option and read its description.

4

Check whether it is recursive, destructive, or requires privilege.

5

Run the narrowest command that satisfies the task.

A configuration file is unfamiliar

1

Determine which program owns the file.

2

Search for the file-format manual page, often in section 5.

3

Identify valid directives and defaults.

4

Preserve the original configuration before meaningful edits.

5

Verify the affected service after the change.

A service command behaves unexpectedly

1

Check systemctl and the relevant unit documentation.

2

Review systemctl status output.

3

Review journalctl evidence.

4

Inspect the unit file and any override files.

5

Understand dependencies before restarting or disabling the service.

You need to locate suspicious files

1

Read the find manual if the expression is complex.

2

Start with observation-only criteria.

3

Confirm quoting and operator behavior.

4

Review results before combining find with a modifying command.

5

Avoid broad deletion pipelines during investigation.

High-impact patterns

Read the documentation before using these broadly

chmod -R

Can alter permissions across an entire directory tree.

chown -R

Can break application ownership across many files.

rm -rf

Removes files recursively without normal confirmation.

find ... -delete

Can delete every object matching a search expression.

systemctl disable --now

Changes startup behavior and immediately stops a service.

iptables / nft flush operations

Can remove active firewall policy and change network exposure.

Weak habit vs better habit

Weak habit

Run the command from memory when the flags are uncertain.

Better habit

Check the manual page or --help before using unfamiliar or high-impact options.

Weak habit

Copy commands from random forum answers.

Better habit

Start with installed man pages and official project or distribution documentation.

Weak habit

Assume a command has the same behavior on every Linux system.

Better habit

Confirm the installed command, distribution, version, and implementation.

Weak habit

Use recursive options to save time.

Better habit

Make the smallest targeted change that solves the verified problem.

Weak habit

Pipe investigation output directly into a modifying command.

Better habit

Review the result set first, then separately perform justified changes.

Weak habit

Treat example commands as universal instructions.

Better habit

Understand what each argument means before adapting an example to the current system.

Linux command reference checklist

01

Use installed man pages as a first-line Linux reference.

02

Know that manual sections distinguish commands, file formats, administration, and other topics.

03

Use man -k when you know the concept but not the command name.

04

Use section 5 references for important configuration-file formats.

05

Use section 8 references for many administration commands.

06

Read scope-changing options carefully.

07

Avoid guessing recursive, force, delete, or disable flags.

08

Use observation commands before modification commands.

09

Confirm distribution and version differences.

10

Use official project documentation when man pages are insufficient.

11

Verify the system after meaningful administrative changes.

12

Let the CyberPatriot scenario determine what should remain enabled and functional.