Two servers that should be identical behave differently. Compare their installed packages.
BeginnerScenarioScenarios: text processing and scheduling decisions
Answer
Situation read → Generate normalized package lists from both and diff them.
What I'd do →
pkgs() { ssh -n "$1" "dpkg-query -W -f='\${Package} \${Version}\n'" | sort; }
diff <(pkgs web1) <(pkgs web2)
# names only, regardless of version
comm -3 <(pkgs web1 | cut -d' ' -f1) <(pkgs web2 | cut -d' ' -f1)
- On RHEL:
rpm -qa --qf '%{NAME} %{VERSION}-%{RELEASE}\n' | sort. - Extend to configs:
diff <(ssh web1 cat /etc/sysctl.conf) <(ssh web2 cat /etc/sysctl.conf).
Why → Process substitution makes remote comparisons one-liners without temp files.
Interview tip → Mention that drift like this is the argument for immutable images or config management.
More on Scenarios: text processing and scheduling decisions
Users report errors in the last hour. From the Nginx access log, find which endpoints produce the most 5xx responses.BeginnerA MySQL slow log is 3 GB. You need the 10 slowest query patterns. What do you do?IntermediateFind which pods were OOMKilled in a namespace, with their container names and restart counts.IntermediateProduce a CSV of running EC2 instances that are missing an `Owner` tag.IntermediateYou have access logs from five web servers and need one timeline sorted by time. How?IntermediateA vendor needs application logs, but they contain emails and card numbers. Mask them first.Intermediate