Linux Cheat Sheet for Production Support Engineers

·

·

Reading time:

7 minutes

Most Linux cheat sheets are alphabetical lists of commands. This one is organised by the job in front of you: an alert has fired, a trader is on the phone, and you have a terminal. Every command here is one I’ve reached for on production trading systems.

Originally published April 2021, rewritten November 2026. Commands assume RHEL/CentOS-style servers; Debian/Ubuntu differences are noted where they matter.

Jump to

1. The first five minutes on a box

Run these before you touch anything. Together they tell you whether the problem is the host or the application.

uptime                          # load average vs. CPU count (check with nproc)
df -h                           # any filesystem at 100%?
df -i                           # out of inodes? (disk "full" with free space)
free -h                         # memory and swap in use
top -b -n 1 | head -20          # top CPU/memory consumers, one snapshot
dmesg -T | tail -30             # kernel messages: OOM killer, disk errors
journalctl -p err -S "-1h"      # errors logged in the last hour (systemd)
last -x | head                  # recent reboots and shutdowns
who -b                          # when the box last booted

2. Logs

tail -F app.log                       # follow, survives log rotation (-F not -f)
less +F app.log                       # follow; Ctrl+C to stop and search with /
grep -n -C 5 "ERROR" app.log          # matches with line numbers and 5 lines of context
grep -c "ERROR" app.log               # count matches
zgrep "OrderId=123" app.log.*.gz      # search rotated, compressed logs
grep -h "ERROR" app.log* | sort | uniq -c | sort -rn | head
                                      # most frequent errors across files
awk '$2 >= "09:00:00" && $2 <= "09:15:00"' app.log
                                      # lines in a time window (time in column 2)
sed -n '/09:00:00/,/09:15:00/p' app.log
                                      # same idea, from first match to second
journalctl -u pricing.service -f      # follow a systemd service's log
journalctl -u pricing.service -S "2026-11-17 08:00" -U "2026-11-17 08:30"

3. Processes

pgrep -af pricing                     # find a process by name, show full command
ps -eo pid,ppid,user,%cpu,%mem,etime,cmd --sort=-%cpu | head
                                      # top processes by CPU, with uptime (etime)
ps -o pid,lstart,cmd -p 4321          # exact start time of PID 4321
pstree -p 4321                        # process and its children
ls /proc/4321/fd | wc -l              # open file descriptors
cat /proc/4321/limits                 # limits, e.g. "Max open files"
lsof -p 4321                          # files and sockets a process has open
strace -p 4321 -f -tt                 # watch system calls live (use with care)
kill 4321                             # SIGTERM: ask it to shut down cleanly
kill -9 4321                          # SIGKILL: last resort, no cleanup
jstack 4321 > /tmp/threads.txt        # Java thread dump (hung app)
jstat -gcutil 4321 1000 5             # Java GC activity, every second, 5 times

4. CPU and memory

nproc                                 # number of CPUs
vmstat 1 5                            # run queue (r), swapping (si/so), I/O wait (wa)
mpstat -P ALL 1 3                     # per-CPU usage: is one core pinned?
sar -u 1 5                            # CPU usage (sysstat)
sar -r -f /var/log/sa/sa17            # memory history from the 17th
free -h                               # look at "available", not "free"
grep -i -E "killed process|out of memory" /var/log/messages
                                      # did the OOM killer strike? (syslog on Debian)

In top: press P to sort by CPU, M by memory, 1 to show every core, H to show threads.

5. Disk and files

du -xh --max-depth=1 /var | sort -h   # biggest directories, this filesystem only
find /var/log -type f -size +500M -exec ls -lh {} \;
                                      # files over 500 MB
find /app/logs -name "*.log" -mtime +7
                                      # logs older than 7 days (check before deleting!)
lsof +L1                              # deleted files still held open (space not freed)
: > /app/logs/huge.log                # truncate a log in place without breaking the writer
iostat -x 1 5                         # disk utilisation and latency (await, %util)
mount | column -t                     # what's mounted where
stat file                             # size, owner, modified/changed times

6. Network and connectivity

ip -br a                              # interfaces and IPs, brief
ss -ltnp                              # listening TCP ports and owning process
ss -tanp state established '( dport = :1521 )'
                                      # open connections to Oracle (port 1521)
ss -s                                 # socket summary (TIME_WAIT build-up?)
nc -zv dbhost 1521                    # is the port reachable?
curl -sv https://api.internal/health  # full request and response headers
curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" https://api.internal/health
                                      # status code and total time only
dig +short api.internal               # DNS lookup
getent hosts api.internal             # resolve the way the app does (incl. /etc/hosts)
traceroute -T -p 443 api.internal     # path to host over TCP
tcpdump -i any -nn port 9876 -w /tmp/fix.pcap
                                      # capture FIX session traffic for analysis

7. TLS certificates

Expired certificates are one of the most common causes of outages, especially on FIX sessions and internal APIs.

openssl s_client -connect api.internal:443 -servername api.internal </dev/null
                                      # handshake and certificate chain
echo | openssl s_client -connect api.internal:443 2>/dev/null | openssl x509 -noout -dates -subject
                                      # expiry dates of a live certificate
openssl x509 -in cert.pem -noout -enddate
                                      # expiry date of a certificate file
openssl x509 -in cert.pem -noout -checkend 2592000
                                      # exits non-zero if it expires within 30 days
keytool -list -v -keystore keystore.jks | grep -E "Alias|Valid"
                                      # Java keystore aliases and validity

8. FIX logs and IBM MQ

tr '\001' '|' < fix.log | less        # make the SOH delimiter readable
grep "35=8" fix.log | grep -c "39=8"  # count rejected execution reports (OrdStatus=8)
grep "35=3" fix.log                   # session-level rejects
grep -E "35=(A|5)" fix.log            # logons and logouts
grep "11=ORD-123" fix.log | tr '\001' '|'
                                      # full lifecycle of one order (ClOrdID)
grep -o "35=[^\x01|]*" fix.log | sort | uniq -c
                                      # message counts by type

dspmq                                 # queue managers and their status
echo "DISPLAY QLOCAL(*) CURDEPTH" | runmqsc QM1
                                      # queue depths: is anything backing up?
echo "DISPLAY CHSTATUS(*)" | runmqsc QM1
                                      # channel status (RUNNING, RETRYING, STOPPED)
echo "DISPLAY QSTATUS(APP.IN) TYPE(QUEUE) IPPROCS OPPROCS" | runmqsc QM1
                                      # are consumers (IPPROCS) attached?

Common MQ reason codes: 2009 connection broken, 2035 not authorised, 2053 queue full, 2059 queue manager not available, 2085 unknown object name.

9. Services, cron and jobs

systemctl status pricing              # state, PID and recent log lines
systemctl restart pricing             # restart (with an approved change or incident!)
systemctl list-units --failed         # anything failed on the box?
crontab -l                            # your scheduled jobs
crontab -l -u appuser                 # another user's (needs sudo)
grep CRON /var/log/cron               # did the job run? (syslog on Debian)
nohup ./eod_report.sh > eod.out 2>&1 &
                                      # run detached from your session
echo $?                               # exit code of the last command (0 = success)

10. Text processing

awk -F, '{print $1, $5}' trades.csv   # pick columns from a CSV
awk -F, '$5 > 1000000' trades.csv      # filter rows by value
awk -F, '{s+=$5} END {print s}' trades.csv
                                      # sum a column
cut -d'|' -f2,4 file                  # columns by delimiter
sort -t, -k3,3 -n trades.csv          # sort numerically by column 3
comm -3 <(sort a.txt) <(sort b.txt)  # lines in one file but not the other
diff <(ssh prod1 cat app.conf) <(ssh prod2 cat app.conf)
                                      # compare config across two servers
jq '.orders[] | select(.status=="REJECTED")' resp.json
                                      # filter JSON
column -t -s, trades.csv | less -S    # readable table view of a CSV
xargs -n1 -P4 ./check.sh < hosts.txt  # run a script against many hosts, 4 at a time

11. Users and permissions

id                                    # who am I, which groups
sudo -l                               # what am I allowed to run as root?
sudo -iu appuser                      # switch to the application user
ls -l file                            # owner, group and permission bits
chmod 640 app.conf                    # owner rw, group r, others none
chown appuser:appgroup app.conf       # change owner and group
umask                                 # default permissions for new files
ModeBitsTypical use
755rwx r-x r-xScripts and directories
750rwx r-x —App directories restricted to the team group
644rw- r– r–Readable config or documentation
640rw- r– —Config the group needs but others must not see
600rw- — —Private keys, credentials files

r = 4, w = 2, x = 1, added up for owner, group and others. Avoid 777 in production: it will fail an audit.

12. File transfer and archives

scp app.log user@jumphost:/tmp/       # copy a file to another server
rsync -avz --dry-run src/ host:/dest/ # preview a sync before doing it
rsync -avz src/ host:/dest/           # sync (trailing slash = contents of src)
sha256sum release.tar.gz              # verify a file hasn't changed in transit
tar czf logs-20261117.tar.gz /app/logs/*.log
                                      # create a gzip archive
tar tzf logs-20261117.tar.gz          # list contents without extracting
tar xzf logs-20261117.tar.gz -C /tmp  # extract into /tmp

13. Safe habits in production

  • Look before you change. Run the read-only version first: find without -delete, rsync --dry-run, ls before rm.
  • Back up before you edit. cp app.conf app.conf.$(date +%Y%m%d%H%M) takes two seconds.
  • Check which box you’re on. hostname before every restart. Prod and UAT prompts look identical.
  • Truncate, don’t delete, open logs. Deleting a file a process is writing to doesn’t free the space.
  • Prefer kill over kill -9. Give the app the chance to close connections and release locks.
  • Record what you did. Paste commands and output into the incident ticket as you go; it becomes your timeline for the post-mortem.
  • No change without a ticket. In a bank, restarts and config changes need an approved change or a logged incident.

Keep going

Rakesh Kadukutty

Senior Production Support Engineer in London with 10+ years supporting Fixed Income and FX trading systems at BNP Paribas and Tradeweb.

About LinkedIn

Get the daily brief

One fintech story every morning, with the interview angle. Free, straight to your inbox.