Essential Linux Commands Every Backend Engineer Needs: Network, Process, and Server Resource Management
This guide lists the most useful Linux command‑line tools for backend developers, covering network diagnostics (ping, netstat, curl, traceroute, ss), process handling (ps, top, kill, nohup, jps), and server resource monitoring (df, du, free, vmstat, iostat, lsof, systemctl) with concrete examples and typical use cases.
Network Management Commands
1. ping – network connectivity test
# Test basic connectivity (send 4 packets)
ping -c 4 api.example.com
# Continuous test (10 packets per second)
ping -i 0.1 -c 10 api.example.comUse case: Verify network reachability. If ping fails, the problem is network‑level; if ping succeeds but the service is unreachable, investigate port or application configuration.
2. netstat – port and connection monitoring
# Show all listening ports
netstat -tuln
# Show a specific port (e.g., 8080)
netstat -tuln | grep :8080
# Show processes owning ports (most common)
netstat -tulnpUse case: When an application reports "port already in use", use netstat -tulnp to locate the owning PID and decide whether to terminate the process or change the configuration.
3. curl – HTTP request testing
# Send a GET request
curl -v https://api.example.com/v1/data
# Send a POST request with JSON payload
curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' https://api.example.com/v1/data
# Save response to a file
curl -o response.json https://api.example.com/v1/dataUse case: Validate API endpoints during development or troubleshoot third‑party API calls in production.
4. traceroute – network path analysis
traceroute api.example.comUse case: Identify bottleneck nodes when a service response is slow, distinguishing between local network problems and remote server issues.
5. ss – modern socket statistics (netstat replacement)
# Show all TCP connections
ss -tuln
# Show a specific port
ss -tuln | grep :8080Use case: ss is faster than netstat and provides more detailed TCP state information.
Process Management Commands
1. ps – process snapshot
# List all processes (including other users)
ps aux
# Filter for a specific process
ps aux | grep java
# Show process hierarchy as a tree
ps axfUse case: Confirm whether a service is running and view parent‑child relationships between processes.
2. top – real‑time system monitoring
top
# Inside the top UI:
# P – sort by CPU
# M – sort by memory
# k – kill a process (enter PID)
# q – quitUse case: When a server becomes sluggish, use top to spot high‑CPU or high‑memory processes.
3. kill – terminate processes
# Terminate a specific PID
kill 12345
# Force kill if normal kill fails
kill -9 12345
# Kill by exact command line match
pkill -f "java -jar myapp.jar"Use case: Quickly stop a misbehaving test service to free its port.
4. nohup & – run commands in background
# Run a long‑running job and ignore SIGHUP
nohup java -jar myapp.jar &
# List background jobs
jobs
# Bring a background job to the foreground
fg %1Use case: Keep a task running after the SSH session is closed.
5. jps – Java process listing
# List all Java processes
jpsUse case: Verify that Java applications are up and running.
Server Resource Management Commands
1. df – disk space usage
# Human‑readable disk usage
df -hUse case: Quickly check disk consumption when storage runs low.
2. du – directory size
# Human‑readable size of a directory
du -sh /var/log
# Find files larger than 100 MB
find / -type f -size +100M -exec ls -lh {} \;Use case: Locate large directories with du -sh, then pinpoint individual large files with find.
3. free – memory usage
# Human‑readable memory summary
free -h
# Detailed memory usage in megabytes
free -mUse case: Diagnose Java memory leaks and decide whether JVM parameters need adjustment.
4. vmstat – overall system performance
# Continuous stats, refreshed every second
vmstat 1Use case: When overall performance degrades, vmstat shows CPU, memory, and I/O metrics to pinpoint the bottleneck.
5. iostat – I/O performance monitoring
# Detailed disk I/O statistics (3 samples, 1 s interval)
iostat -x 1 3Use case: Identify disk I/O saturation when application read/write latency is high.
6. lsof – list open files
# Find process using a specific port
lsof -i :8080
# List processes that have opened a particular file
lsof /var/log/app.logUse case: Before deleting a file that is in use, use lsof to see which processes hold it.
7. systemctl – service management
# Check service status
systemctl status nginx
# Restart a service
systemctl restart nginx
# Start a service
systemctl start nginxUse case: Manage services such as Nginx or MySQL on a Linux server using standardized commands.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer1970
Formerly called 'Code to 35'. Add our main WeChat ID to access a wealth of shared resources (algorithms, interview prep, tech stacks: Java, Python, Go, big data). We mainly share serious development techniques, focusing on output-driven input. Occasionally we post life snippets and gossip. Our aim is to attract precise traffic and test advertising opportunities.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
