HCAW Command Examples

A command laboratory for How Computers Actually Work. These examples connect visible Linux commands to the hidden behavior beneath: services, processes, memory, page faults, translation, cache, and diagnostics.

Service / systemd

systemctl status <service>
Shows how a service is known to systemd: active state, main PID, recent logs, and whether the unit is loaded.
Try with a real service such as sshd, nginx, or NetworkManager.
systemctl list-units --type=service
Shows systemd’s view of running and loaded services. This connects to the idea that systemctl is a client asking systemd for system state.
journalctl -u <service>
Shows logs for a specific unit, connecting service behavior to systemd’s logging path.

Processes

ps -ef
Shows running processes, parents, and command lines. Useful for seeing the result of fork/exec in the live system.
pstree -p
Displays process ancestry as a tree. This makes parent/child process relationships visible.
pgrep -a <name>
Finds processes by name and displays their full command line.

Memory / Address Space

cat /proc/self/maps
Shows the memory layout of the current shell command process: text, libraries, heap, stack, and mapped regions.
This is the live companion to the Stack / Heap / mmap section.
cat /proc/<pid>/maps
Shows the memory map of a specific process. Use with a PID found from ps or pgrep.
free -h
Shows system memory usage in human-readable form. Useful for overall RAM and swap context.

Page Faults

ps -o min_flt,maj_flt,cmd -p <pid>
Displays minor and major page fault counts for a process. Minor faults are usually normal; major faults indicate disk or backing-store access.
vmstat 1
Shows live system memory behavior, including swap activity and CPU wait context.
time <command>
Gives a simple timing view of a command. Useful when comparing cached vs uncached behavior.

Performance / CPU Memory Path

perf stat <command>
Runs a command and reports performance counters. This is the gateway into cache misses, TLB misses, and CPU cycles.
perf stat -e cycles,instructions,cache-references,cache-misses <command>
Focuses on CPU work and cache behavior. Good for seeing whether work is computation-heavy or memory-sensitive.
top
Gives a live system overview: CPU, memory, load, and active processes.

Suggested Investigation Path

1. systemctl status
Start with service state.
2. ps / pstree
Locate the process and its parentage.
3. /proc/<pid>/maps
Inspect the process memory layout.
4. ps min_flt / maj_flt
Check page fault behavior.
5. perf stat
Look for cache and CPU-memory performance clues.