Logo ← PostgreSQL Blog

7 Essential Linux Packs Every Software Engineer Should Know


7 Essential Linux Packs Every Software Engineer Should Know

A practical, copy-paste friendly Linux toolkit for software engineers, sysadmins, DBAs, and SREs. This is not just another “Introduction to Linux” guide; it is a curated “copy-paste-save” cheat sheet of essential commands that every developer should have in their back pocket for daily operations and emergency debugging.

Table of Content

  1. Networking 2.0: ss, tcpdump, ip addr
  2. Text Processing (The Holy Trinity): grep, awk, sed
  3. Observability: htop, iostat, vmstat
  4. Deep Debugging: strace, lsof, journalctl
  5. Storage Management: du, find, ncdu
  6. PostgreSQL & Ops: pg_top, psql, pg_dump
  7. Quick Analytics: wc, sort, uniq

1. Networking 2.0 (The Modern Stack)

Forget netstat and ifconfig. Modern kernels require faster, more detailed tools to diagnose connectivity issues.

  • ss -tulpn: The netstat killer. View all listening TCP/UDP sockets with process IDs.
ss -tulpn
  • tcpdump -i eth0 port 80 -A: Sniff traffic on port 80 and display packets in ASCII for quick debugging.
sudo tcpdump -i eth0 port 80 -A
  • ip -c addr: Clearly list network interfaces and IP addresses with color coding.
ip -c addr

2. Text Processing (The Holy Trinity)

The power of Linux lies in its ability to treat text as data. These three tools allow you to query logs like a database.

  • rg "ERROR" ./logs: (ripgrep) The fastest way to search through massive directories with regex.
rg "ERROR|WARNING" /var/log/nginx/access.log
  • awk '{print $1, $9}' access.log: Isolate specific columns (like IP and Status Code) from a log file.
awk '{print "IP:", $1, "Status:", $9}' /var/log/apache2/access.log
  • sed -i 's/old-api/new-api/g' config.yaml: Fast, non-interactive search and replace across files.
sed -i 's/localhost:8080/my-service.com/g' config.yaml

3. Observability & Performance Monitoring

Stop guessing why the system is slow. Use these to find the exact bottleneck in real-time.

  • btop: A high-definition, interactive dashboard for CPU, Memory, and Network.
btop
  • iostat -xz 1: Check if your disks are struggling with high wait times or utilization.
iostat -xz 1
  • vmstat 1: Monitor system memory, swap, and CPU scheduling at 1-second intervals.
vmstat 1

4. Deep Debugging (Under the Hood)

When an app works on your machine but fails on the server, you need to see exactly what the OS is doing.

  • strace -p <pid>: Attach to a process to see every system call it makes (files opened, network calls, errors).
sudo strace -p 12345
  • lsof -i :5432: Instantly find which process is holding a specific port hostage.
sudo lsof -i :5432
  • journalctl -u podtgres.service -f -n 100: Follow the last 100 lines of a specific service's logs in real-time.
sudo journalctl -u postgres.service -f -n 100

5. Storage & Filesystem Management

“Disk full” errors are the nightmare of every engineer. These tools help you find the space-hogging culprits in seconds before they crash your services.

  • du -sh * | sort -h: List sizes of all files/folders in the current directory, sorted from smallest to largest.
du -sh * | sort -h
  • find /var/log -mtime -1: Find every file in /var/log that was modified in the last 24 hours. Great for tracking down runaway logs.
find /var/log -mtime -1
  • ncdu: An interactive, terminal-based disk usage analyzer. It’s the fastest way to navigate and clean up large directories.
ncdu /var/lib/docker

6. PostgreSQL & Ops (DBA Tricks)

Managing databases via terminal is a superpower. These tricks bridge the gap between Linux operations and database management.

  • pg_top: Like top, but specifically for monitoring PostgreSQL queries, lock states, and active transactions.
pg_top -d my_database
  • psql -c + awk: Execute an SQL command and pipe the output to awk to extract a single value for your automation scripts.
psql -d dbname -t -c &amp;amp;quot;SELECT count(*) FROM users&amp;amp;quot; | awk &amp;amp;#x27;{$1=$1;print}&amp;amp;#x27;
  • pg_dump | gzip: Dump your database and compress it on the fly to save bandwidth and storage during migrations.
pg_dump -U username dbname | gzip &amp;amp;gt; backup.sql.gz

7. Quick Analytics & Summarization

Who needs a Python script for basic log analysis? Use the shell to generate instant frequency reports and status checks.

  • wc -l: The fastest way to count lines (requests, errors, or records) in any text file.
wc -l access.log
  • sort | uniq -c: The ultimate frequency analyzer. Count how many times each unique line appears (e.g., finding the most frequent error source).
cat access.log | awk &amp;amp;#x27;{print $9}&amp;amp;#x27; | sort | uniq -c | sort -nr

(Pro Tip: This example counts HTTP status codes and sorts them by frequency.)

  • head -n 20 / tail -f: Peek at the first 20 lines or follow the live stream of a log file to catch errors as they happen.
tail -f /var/log/syslog | grep --color &amp;amp;quot;ERROR&amp;amp;quot;

Final Thoughts

Mastering these 7 packs doesn’t just make you faster it makes you a more reliable engineer when things go south. Copy these, save them in your .bashrc or .zshrc aliases, and use them daily.

Did I miss your favorite trick? Let me know in the comments!