Linux Networking, Process and Resource Management

Introduction
When your application says “connection refused”, do you know what to check?
In this guide, we’ll explore the essential Linux networking, Process and Resource Management tools every DevOps engineer should know.
Know Your IP Address and Interfaces:
Get your IP address
ip a
Look for something like:
inet 192.168.1.100/24
Check hostname
hostname
ping: Are We Even Connected?
Check if a server is reachable:
ping google.com
Press ctrl+c to exit
Stops after 4 packets
ping -c 4 google.com
Use IP to rule out DNS issues:
ping 8.8.8.8 //google ip
If IP works but domain fails, your DNS is broken.
curl: Talk to Web Services
Basic usage:
curl http://localhost:8080
#####Response#####
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="https://www.google.com/">here</A>.
</BODY></HTML>
Include headers:
curl -I https://google.com
#####Response#####
HTTP/2 301
location: https://www.google.com/
content-type: text/html; charset=UTF-8
content-security-policy-report-only: object-src 'none';base-uri 'self';script-src 'nonce-n3v5G1r1RqFCsv_MXvlk2A' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp
date: Sun, 27 Jul 2025 17:16:53 GMT
expires: Tue, 26 Aug 2025 17:16:53 GMT
cache-control: public, max-age=2592000
server: gws
content-length: 220
x-xss-protection: 0
x-frame-options: SAMEORIGIN
alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
DNS Tools:
Resolve a domain:
Gives A record, DNS server used, TTL, and more.
dig google.com
#####Response#####
; <<>> DiG 9.10.6 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 34035
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 64 IN A 172.217.169.14
;; Query time: 9 msec
;; SERVER: 2a0e:cb01:176:4100:7612:13ff:fe15:c780#53(2a0e:cb01:176:4100:7612:13ff:fe15:c780)
;; WHEN: Sun Jul 27 18:18:20 BST 2025
;; MSG SIZE rcvd: 55
Firewalls:
Check if firewall is running
sudo ufw status
Allow a particular port:
sudo ufw allow 8080
Deny all incoming connections:
sudo ufw default deny incoming
Summary:
Tool | Purpose |
ping | Test connectivity |
curl | Interact with web APIs and ports |
dig | DNS lookup |
ufw | Manage Linux firewalls |
Process & Resource Monitoring
top – Real-time System Monitor
top
You’ll see something like this:
PID COMMAND %CPU TIME #TH #WQ #PORT MEM PURG CMPRS PGRP
10210 top 5.6 00:00.70 1/1 0 27 7824K 0B 0B 10210
488 WindowServer 2.2 01:53:35 22 6 2320 315M+ 68M- 33M 488
0 kernel_task 1.5 67:00.20 646/10 0 0 10M 0B 0B 0
4874 Google Chrom 0.8 12:50.80 45 2 1285 195M+ 32K 27M 4874
7084 Terminal 0.5 00:09.45 8 3 320- 101M+ 51M- 5840K 7084
10152 Google Chrom 0.3 01:33.22 21 1 206 187M 944K 0B 487
Use this when a server is slow — find out which process is eating resources.
ps: Show Running Processes
ps
shows the running process
PID TTY TIME CMD
10168 ttys001 0:00.08 -zsh
free: Memory and Swap Usage
free -h
ooutput
total used free shared buff/cache available
Mem: 2.0G 1.4G 100M 50M 500M 300M
Swap: 1.0G 512M 488M
Used: What’s currently in use
Free: Really unused RAM
Available: What your system can still use
Swap: Virtual memory when RAM is full
If available RAM is low, your app may get killed (OOM error).
uptime: CPU Load Average
uptime
sample output:
18:31 up 20 days, 18:30, 2 users, load averages: 1.21 1.36 1.48
The last 3 numbers (1.21, 1.36, 1.48) are:
1 minute
5 minutes
15 minutes load average
💡 Load average ≈ number of active processes.
If it’s > number of CPU cores, your system is under heavy load.
For a 4-core system, a load of 3.0 is OK, 6.0 = too high.
df – Disk Free Space
df -h
output:
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk3s1s1 926Gi 10Gi 861Gi 2% 426k 4.3G 0% /
devfs 201Ki 201Ki 0Bi 100% 698 0 100% /dev
/dev/disk3s6 926Gi 20Ki 861Gi 1% 0 9.0G 0% /System/Volumes/VM
/dev/disk3s2 926Gi 6.7Gi 861Gi 1% 1.2k 9.0G 0% /System/Volumes/Preboot
If /
is 100%, your system may crash! Always monitor this.
du – Directory Space Usage
du -sh *
Shows size of all folders in current directory:
230M Desktop
0B Documents
2.3G Downloads
7.4G Library
12K Movies
740K Music
68K Personal-Portfolio
7.3M Pictures
0B Public
It helps find what’s filling your disk.
Kill by PID
kill 1345
Kill a stubborn process
kill -9 1345
-9 is a force kill (SIGKILL)
Kill by name
killall nginx
Use responsibly. You can crash services if used blindly.
Mastering grep
, |
, and awk
— DevOps Superpowers for Filtering and Processing Logs
As a DevOps engineer, you'll spend a lot of time staring at logs, shell outputs, and command results. But when you're looking at thousands of lines, how do you:
Find errors quickly?
Extract just what you need?
Automate log parsing?
That’s where the holy trio of Linux commands comes in:
grep
→ Find what you’re looking for|
(pipe) → Pass output from one command to anotherawk
→ Extract and transform data
Let’s learn how to use them with simple, clear examples.
grep
— Search Through Text
Think: “Give me lines that match this word.”
Basic usage:
grep "error" app.log
Finds all lines that contain the word error in the app.log
file.
Real-world example:
grep "ERROR" /var/log/nginx/error.log
You’ll get:
[Sat Jul 27 13:00:42] ERROR: Connection refused
[Sat Jul 27 13:02:19] ERROR: Timeout reached
Case-insensitive search:
grep -i "error" app.log
Matches Error
, ERROR
, etc.
|
(Pipe) — Combine Commands Like Lego Blocks
Think: “Send the output of one command to another.”
For example:
ps aux | grep nginx
Breakdown:
ps aux
lists all processes|
sends that list togrep
grep nginx
filters only lines with “nginx”
Example:
cat /var/log/syslog | grep "docker"
Or shorter:
grep "docker" /var/log/syslog
Piping is useful when the first command doesn’t support filtering directly.
awk
— Extract Specific Columns
Think: “Print the 5th column from each line.”
Basic usage:
awk '{print $1}' file.txt
This prints the first column from each line.
Example: List users running processes
ps aux | awk '{print $1}'
What’s happening:
ps aux
→ list all processesawk '{print $1}'
→ extract user column
Output:
root
ubuntu
nginx
Example: Show only IPs from access logs
cat access.log | awk '{print $1}' | sort | uniq -c
This gives you a count of unique IPs hitting your server.
DevOps Use Cases
Use Case | Command |
Find errors in logs | grep "error" app.log |
List Nginx processes | `ps aux |
Count failed login attempts | `grep "Failed password" /var/log/auth.log |
Extract memory usage | `free -m |
Subscribe to my newsletter
Read articles from sivasai papani directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
