Illustrative interview practice. Generic company names and hostnames do not represent any specific organization.
Command Sheet
These are the commands the drills use, grouped by what you are trying to find out. You do not need to memorise the options. You do need to know what each one tells you.
Where a command contains <pid>, put the number of the process you are looking at in its place.
Is the computer busy?
Command
What it shows you
top
A live list of processes with the processor and memory each is using
uptime
The load average: roughly how many processes want to do something right now
vmstat 1
Once a second: processes waiting for the processor, processes waiting on a disk, and memory in use
iostat -x 1
How busy each disk is and how long requests to it wait
pidstat -w 1
How often each process is put down and picked up again
free -m
Memory used, free and available, in megabytes
dmesg -T | grep -i oom
Whether the system has stopped a program for running out of memory
ps -eo state,pid,cmd
Every process with its state, such as running, sleeping or waiting on a disk
ps -eLf | wc -l
A count of every thread on the computer
Has a limit been reached?
Command
What it shows you
ulimit -n
How many files one process may have open
ulimit -u
How many processes this user may run
cat /proc/sys/fs/file-nr
Open files in use against the maximum, for the whole computer
lsof -p <pid>
Every file and connection one process has open
sysctl net.core.somaxconn
The longest the waiting line for new connections may be
cat /proc/sys/net/ipv4/ip_local_port_range
The range of port numbers that outgoing connections may borrow
sysctl net.netfilter.nf_conntrack_count
How many connections the firewall is tracking right now
sysctl net.netfilter.nf_conntrack_max
The most connections the firewall can track
What are the connections doing?
Command
What it shows you
ss -s
A summary of network connections by state
ss -tan state close-wait
Connections the other side has closed but this program has not
ss -tan state time-wait
Connections that have closed and are waiting out a short safety period
ss -ti
For each connection, its round-trip time and how often data was sent again
ss -tln
Which ports this computer is listening on
netstat -s
Running totals of dropped, refused and re-sent traffic
nstat -az TcpExtListenOverflows TcpExtListenDrops
How many new connections were dropped because the waiting line was full
sar -n DEV 1
Traffic and errors on each network interface, once a second
tcpdump -ni any port 443
The packets arriving and leaving on one port, as they happen
Can users find and reach the service?
Command
What it shows you
dig app.example.com +short
The addresses a name leads to right now
nslookup app.example.com
The same lookup, with a tool found on most computers
traceroute app.example.com
Each hop on the way to a server
mtr -rw app.example.com
Each hop, with the delay and loss at every one
curl -sv https://app.example.com/ -o /dev/null
The connection, the handshake and the status code of one request