1. Cheat sheets
  2. Engineering Roles

9 minReference

TechOps and IT operations cheat sheet

IT operations on a few screens: Linux admin commands, systemd and journalctl, a network diagnosis ladder with Linux, macOS and Windows commands side by side, store network troubleshooting, accounts and MFA, the device fleet and the service desk. Keep it open on the support desk and on store visits.

Linux admin: "I want to..."

Commands for Debian, Ubuntu and the RHEL family. Where they differ, both are shown. Check the host name in your prompt before anything destructive (Linux CLI).

I want to...CommandLesson
Know which machine and OS this ishostname, cat /etc/os-release, uname -r (kernel)Linux CLI
See load, memory and diskuptime, free -h, df -hLinux CLI
Find what fills the disksudo du -sh /var/* | sort -h; big files: sudo find / -xdev -type f -size +500MLinux CLI
See the heaviest processesps aux --sort=-%cpu | head, or top (press M to sort by memory)Linux CLI
Stop a process politely, then firmlykill <pid> (TERM), then kill -9 <pid> only if it ignores thatLinux CLI
Follow a log filetail -f /var/log/syslog (Debian, Ubuntu) or /var/log/messages (RHEL)Linux CLI
Install updatessudo apt update && sudo apt upgrade or sudo dnf upgradeDevice fleet
Add a user with a home foldersudo useradd -m -s /bin/bash ama, then sudo passwd amaAccounts and MFA
Give a user admin rightssudo usermod -aG sudo ama (Debian, Ubuntu) or -aG wheel (RHEL)Accounts and MFA
Lock an account when someone leavessudo usermod -L ama and sudo chage -E 0 ama; remove their SSH keysAccounts and MFA
See a user's groups and recent loginsid ama, last -n 20Accounts and MFA
Set file owner and permissionssudo chown sync:sync /opt/sync/config.yml, chmod 640 /opt/sync/config.ymlLinux CLI
Make an SSH key and install itssh-keygen -t ed25519, then ssh-copy-id user@hostAccounts and MFA
Copy a folder to another hostrsync -avz ./reports/ user@host:/srv/reports/ (add --dry-run first)Shell scripts
Pack and unpack an archivetar -czf logs.tar.gz /var/log/app, tar -xzf logs.tar.gzLinux CLI
Run a job on a schedulecrontab -e; 15 2 * * * /opt/sync/nightly.sh = 02:15 every dayShell scripts

systemd and journalctl

On systemd distributions (most current ones) services are units. After editing a unit file, run sudo systemctl daemon-reload before restarting it (Linux CLI).

I want to...CommandLesson
See whether a service runs, and its last log linessystemctl status nginxLinux CLI
Start, stop, restart, reload configsudo systemctl start|stop|restart|reload nginxLinux CLI
Start now and at every bootsudo systemctl enable --now sync-agentLinux CLI
List everything that failedsystemctl --failedLinux CLI
Read a service's logs for the last hourjournalctl -u nginx --since "1 hour ago"Linux CLI
Follow logs livejournalctl -u sync-agent -fLinux CLI
Only errors since this bootjournalctl -p err -bLinux CLI
Logs from the previous boot (after a crash)journalctl -b -1 (needs persistent journal storage)Linux CLI
See and shrink journal disk usejournalctl --disk-usage, sudo journalctl --vacuum-time=14dLinux CLI
See scheduled timerssystemctl list-timersShell scripts

A service unit to copy

Save as /etc/systemd/system/sync-agent.service. It restarts the store sync agent if it crashes and waits for the network at boot (Linux CLI).

INI
[Unit]
Description=Mangrove store sync agent
After=network-online.target
Wants=network-online.target

[Service]
User=sync
ExecStart=/opt/sync/bin/sync-agent
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

Safer shell scripts

Start every bash script with strict mode, quote every variable, and run ShellCheck on it before it touches 320 stores (Shell scripts).

Terminal
#!/usr/bin/env bash
set -euo pipefail          # stop on errors, unset variables and failed pipes

store="${1:?usage: rotate-logs.sh STORE_ID}"
dry_run="${DRY_RUN:-1}"    # default to a dry run

for f in /var/log/pos/"$store"/*.log; do
  if [[ "$dry_run" == "1" ]]; then
    echo "would compress $f"
  else
    gzip -- "$f"
  fi
done

Network diagnosis ladder

Work from the bottom up and stop at the first rung that fails. On Windows PowerShell 5.1, curl is an alias for Invoke-WebRequest; type curl.exe to get real curl, which ships with Windows 10 and 11 (Store networks, Networking).

QuestionLinux and macOSWindowsLesson
Do I have an address, and which one?ip a (macOS: ifconfig)ipconfig /allStore networks
What is my gateway?ip route (macOS: netstat -rn)ipconfig, route printStore networks
Can I reach the gateway, then the internet?ping -c 4 192.168.10.1, then ping -c 4 1.1.1.1ping -n 4 192.168.10.1Store networks
Does the name resolve?dig api.example.com +short or nslookupResolve-DnsName api.example.com or nslookupNetworking
Where along the path does it stop?traceroute, or mtr if installedtracert, pathpingNetworking
Is the port open?nc -vz api.example.com 443Test-NetConnection api.example.com -Port 443Store networks
Does the web service answer?curl -I https://api.example.com/healthcurl.exe -I https://api.example.com/healthRequest journey
Is the certificate valid?openssl s_client -connect api.example.com:443 -servername api.example.comOpen the URL in a browser; view the certificateCryptography
What is listening here?sudo ss -tulpn (macOS: lsof -iTCP -sTCP:LISTEN)netstat -ano, Get-NetTCPConnection -State ListenLinux CLI
Which devices are on my segment?ip neigh (macOS: arp -a)arp -aStore networks
Clear a stale DNS cacheresolvectl flush-caches (systemd-resolved); macOS: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderipconfig /flushdnsNetworking
Get a fresh DHCP addressDepends on the network manager; reconnect the interfaceipconfig /release, then ipconfig /renewStore networks

Store network: if you see X, check Y

Mangrove's tills keep selling offline and queue sales for upload, so "the internet is down" is rarely a stop-the-store emergency. Card payments and app orders are the urgent part (Store networks, Offline sync).

You seeLikely causeCheck firstLesson
All tills offline, phones on mobile data fineStore line or router downRouter lights and WAN status; fail over to the 4G backup link if the store has oneStore networks
One till offline, the others fineCable, switch port or that till's settingsLink light; swap the cable or port; ipconfig /all on the tillStore networks
Address starts with 169.254No DHCP answer (Windows gave itself an address)DHCP server or scope full; VLAN on the switch portStore networks
Websites by IP work, by name do notDNSnslookup against the store's DNS and a public oneNetworking
Handheld scanners drop in the cold room or stockroomWeak Wi-Fi signal or roaming between access pointsSignal strength at that spot; access point placement and channelsStore networks
Everything slow at the same time each dayLink saturated: backups, updates or video streamsRouter traffic graphs; schedule updates at night; traffic priority for paymentsStore networks
"Certificate not valid" on many devices at onceDevice clocks wrong, or a certificate expiredDate and time on the device; NTP; the certificate's expiry dateCryptography
Sales queue on tills never emptiesSync service down or rejecting batchesSync agent status and logs; quarantine of rejected batchesPOS sales sync

Network numbers worth remembering

WhatValueLesson
Private IPv4 ranges10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16Networking
Hosts per subnet/24 = 254, /23 = 510, /22 = 1,022, /25 = 126Store networks
Self-assigned address (no DHCP)169.254.0.0/16Store networks
Common ports22 SSH, 53 DNS, 67 and 68 DHCP, 80 HTTP, 123 NTP, 443 HTTPS, 445 SMB, 3389 RDP, 5432 Postgres, 6379 RedisNetworking
2.4 GHz Wi-Fi channels that do not overlap1, 6 and 11Store networks
Round trip, roughSame building under 5 ms; same country 10 to 50 ms; another continent 100+ msNetworking

Accounts and MFA

Every account belongs to one named person, created from HR data and removed the same day they leave. Shared logins on tills become personal PINs or badges, so every sale and refund has a name (Accounts and MFA, Identity).

EventDoWatch forLesson
JoinerCreate from the HR record; give the role's standard groups; enrol MFA on day oneCopying another person's access ("make her like Leila")Accounts and MFA
MoverAdd the new role's access and remove the old role's on the same ticketAccess that only ever growsAccounts and MFA
LeaverDisable on the last day, revoke sessions and tokens, collect devices, transfer filesAccounts still active weeks later; personal phones still enrolledAccounts and MFA
Admin accessA separate admin account with phishing-resistant MFA, used only for admin workDaily email on an account with domain admin rightsIdentity
Break-glassTwo emergency accounts, long random passwords stored offline, alert on every useNobody knowing where they are when the identity provider is downIdentity
ReviewManagers confirm their team's access every quarterReviews that approve everything without readingAccounts and MFA
MFA reset requestVerify the person by a second channel (call back on the HR number, manager confirms)Resetting MFA because a caller sounds stressedBreaches
Windows and Active Directory taskCommandNote
Who am I and which groups am I inwhoami /groupsBuilt in
Look up a domain usernet user ama /domainBuilt in
Last logon and lockout stateGet-ADUser ama -Properties LastLogonDate,LockedOutNeeds the ActiveDirectory module (RSAT)
Find and unlock locked accountsSearch-ADAccount -LockedOut, Unlock-ADAccount amaNeeds the ActiveDirectory module (RSAT)
Disable a leaverDisable-ADAccount amaNeeds the ActiveDirectory module (RSAT)

The device fleet

Mangrove runs about 400 tills, 1,000 handheld scanners and the head-office laptops. Every device is in an asset register and enrolled in a device management tool (MDM) before it leaves the warehouse (Device fleet).

StageDoMangrove exampleLesson
EnrolRegister serial, owner and location; enrol in MDM; encrypt the diskScanner SC-0412 enrolled to store S-014 before shippingDevice fleet
ConfigureApply a standard profile; lock single-purpose devices into kiosk modeScanners run only the Store app; no browser, no app storeDevice fleet
PatchRings: IT first, then pilot stores, then everyone, with a deadline by severityTill updates go to 5 pilot stores overnight, then all stores a week laterDevice fleet
MonitorCheck-in date, OS version, disk encryption, battery healthReport: scanners not seen for 7 days, by storeDevice fleet
Lost or stolenLock or wipe remotely; revoke its certificates and tokens; log the incidentA rider's phone lost on a delivery runDevice fleet
RetireWipe, remove from MDM and the directory, update the register, recycle properlyOld tills replaced in a store refitDevice fleet
Windows desk-side taskCommand
Windows version and buildwinver; details: systeminfo
Pull group policy now, see what appliedgpupdate /force, gpresult /r
Check BitLockermanage-bde -status (admin prompt)
Repair system filesDISM /Online /Cleanup-Image /RestoreHealth, then sfc /scannow (admin prompt)
List installed updatesGet-HotFix
Restart nowshutdown /r /t 0

Service desk basics (ITIL words)

Use the same words as the rest of the business and the tickets sort themselves (Service desk).

Ticket typeMeansMangrove exampleGoal
IncidentSomething that worked is broken or degradedTill 2 at S-014 will not print receiptsRestore service fast, even with a workaround
Service requestA normal ask from the catalogueNew starter needs a laptop and a Store app loginFulfil to the promised time
ProblemThe unknown cause behind one or more incidentsReceipt printers fail across 30 stores after an updateFind and remove the root cause
ChangeAdding, modifying or removing something that could affect serviceNew router firmware for every storeMake it safely: plan, approve, schedule, roll back if needed
Known errorA problem with a documented cause and workaround"Restart the print spooler" until the driver fix shipsLet the first line fix it on the first call

Priority matrix

Priority comes from impact (how many people or how much money) and urgency (how fast it gets worse). The targets below are an example; agree your own with the business (Service desk).

Impact \ UrgencyHighMediumLow
High (many stores, card payments, app checkout)P1: respond 15 min, work until fixedP2: respond 30 min, fix in 4 hP3: respond 4 h, fix in 2 days
Medium (one store, one team)P2: respond 30 min, fix in 4 hP3: respond 4 h, fix in 2 daysP4: respond 1 day, fix in 5 days
Low (one person, has a workaround)P3: respond 4 h, fix in 2 daysP4: respond 1 day, fix in 5 daysP4: respond 1 day, fix in 5 days

A ticket the next person can act on

Output
Summary:   Receipt printer offline on till 2, store S-014
Reported:  Ama (store manager), 09:40, by phone
Impact:    1 of 4 tills; customers offered e-receipts; queue normal
Priority:  P3 (medium impact, medium urgency)
Done:      Power cycled printer; checked USB cable; test page fails
Found:     Printer shows "paper jam" light, no paper inside
Next:      Swap printer from the spare stock; ship faulty unit to the DC
Status:    Waiting on store to fit spare (ETA 11:00)

Good first response: confirm what you understood, say what happens next and when you will update them. Close only when the user agrees it is fixed, and turn repeat fixes into a knowledge article so the first line can solve them (Service desk, Toil).

Glossary

Plain definitions of the IT operations terms used in the TechOps course.

Asset register
The list of every device with its serial, owner, location and status. Device fleet
Break-glass account
An emergency admin account for when normal sign-in is broken, kept offline and alerted on. Identity
Change advisory
The review that approves risky changes and their timing and rollback plans. Service desk
CIDR
Writing a network as an address and prefix length, such as 192.168.10.0/24 (254 usable hosts). Store networks
Cron
The Linux scheduler that runs commands at set times from a crontab. Shell scripts
DHCP
The service that hands devices an IP address, gateway and DNS server when they join a network. Store networks
DNS
The system that turns names like api.example.com into IP addresses. Networking
Gateway
The router a device sends traffic to when the destination is outside its own network. Store networks
Joiner, mover, leaver (JML)
The three moments when someone's access must change: they start, change role or leave. Accounts and MFA
Journal
systemd's log store, read with journalctl. Linux CLI
Kiosk mode
Locking a device to one or a few apps, as on handheld scanners and tills. Device fleet
Knowledge article
A short, searchable fix for a known issue, written so the first line can solve it. Service desk
MDM
Mobile device management: a tool that enrols, configures, updates and wipes devices remotely. Device fleet
MFA
Multi-factor authentication: a second proof besides the password. Accounts and MFA
NTP
Network Time Protocol, which keeps device clocks right; wrong clocks break certificates and logs. Store networks
Patch ring
A group that gets updates at a set stage, so problems show up on a few devices first. Device fleet
Problem
In ITIL, the underlying cause of one or more incidents. Service desk
Shift left
Moving fixes to the earliest level that can handle them: self-service, then first line. Service desk
SLA
Service level agreement: the response and fix times promised for each priority. Service desk
systemd unit
A file that tells systemd how to run and restart a service, timer or mount. Linux CLI
VLAN
A separate virtual network on the same switches, such as tills apart from guest Wi-Fi. Store networks
Workaround
A way to restore service before the root cause is fixed. Service desk

Courses on Kolom

  • The Linux Command Line by William Shotts, free at linuxcommand.org. From the first command to shell scripts.
  • Windows commands reference at learn.microsoft.com. Every built-in command with its options.
  • ShellCheck at shellcheck.net. Paste a script and it explains each bug it finds.
  • The Practice of System and Network Administration by Thomas Limoncelli, Christina Hogan and Strata Chalup. How good IT teams run fleets, help desks and changes.
  • NIST SP 800-63B at pages.nist.gov. The guidance behind modern password and MFA rules.