Introduction
Almost every server a DevOps engineer touches runs Linux. The containers run on Linux, the virtual machines run Linux, the CI runners run Linux, and the cloud instances underneath it all run Linux. You can learn Docker, Kubernetes and Terraform without ever opening a terminal on a Linux host, but the first time a deployment fails at 2 a.m., the difference between a DevOps engineer who knows Linux and one who does not is the difference between reading the system and guessing at it.
This guide covers the Linux skills a DevOps engineer actually uses every day. Not the whole operating system — that would fill a shelf of books — but the working set: processes, systemd, networking, users and permissions, filesystems and disk, logs, package management, and shell scripting as the glue that holds it all together. Every command shown here is a real command with correct flags, and the final section ties them together in a single debugging workflow: a service that will not start.
If you are still learning the basic commands, start with our Linux Commands for DevOps Engineers guide first. This article assumes you can move around a filesystem, edit a file and run a command with sudo — and builds from there.
Version note (28 Nov 2026): the examples in this article were written against Ubuntu 24.04 LTS, the current long-term support release. Canonical provides standard security maintenance for Ubuntu 24.04 LTS until May 2029, and expanded security maintenance with Ubuntu Pro until May 2034. systemd is the standard init system on Ubuntu, Debian and Red Hat Enterprise Linux, so the systemctl and journalctl commands here work the same way on all three.
Processes and systemd — What Is Running, and Who Starts It
A Linux system is a collection of processes. A process is a running program: a web server, a database, a build agent, a shell. When something is slow, broken or missing, the first question is always the same — what is running, how much is it using, and who started it?
Seeing processes
The two classic commands are ps and top:
ps aux ps -ef top htop
ps aux lists every process with its owner, CPU and memory use, and the command that started it. ps -ef shows the same information in a different layout, with parent process IDs — useful when you want to see which process started which. top shows a live, updating view sorted by CPU use; press q to quit, M to sort by memory instead, and k to kill a process from inside top. htop is the same idea with a friendlier interface, including a tree view (F5) that shows parent and child processes together. It is not installed by default on most servers, so install it when you need it — see the package management section below.
When a process is stuck in a loop, it can be stopped gracefully with kill, which by default sends SIGTERM — a polite request to shut down:
kill 1234 kill -TERM 1234 kill -9 1234
kill -9 sends SIGKILL, which the process cannot ignore or catch. It works when nothing else does, but it gives the process no chance to close files, flush buffers or clean up — so use it as a last resort, not a first step. If you do not know a process ID, find it by name:
pgrep -a nginx pidof nginx
systemd: the service manager
On a modern Linux server, almost everything that runs at boot — and stays running — is managed by systemd. A unit is systemd’s word for a thing it manages: a service (.service), a timer (.timer), a mount (.mount), a socket (.socket). The command you will use most is systemctl:
systemctl status nginx systemctl start nginx systemctl stop nginx systemctl restart nginx systemctl reload nginx systemctl enable nginx systemctl disable nginx systemctl is-enabled nginx systemctl is-active nginx
The distinction between start and enable catches every beginner once. start runs a service now. enable makes it start automatically at boot. A service can be started but not enabled — in which case it stops working after the next reboot — or enabled but not started. After installing a service, run both: systemctl enable –now nginx does both in one command.
restart stops and starts a service; reload asks a running service to re-read its configuration without dropping connections, where the service supports it. For nginx, reload after a configuration change is the right call. For a service whose configuration only takes effect at startup, use restart.
When a service fails, systemctl status is the first place to look. It shows whether the service is active, failed or inactive, when it last started, its process ID, and the last few lines of its log:
systemctl status nginx --no-pager systemctl list-units --failed systemctl list-unit-files --type=service
systemctl list-units –failed is a quick health check for a whole server: any unit in a failed state shows up here. Unit files live in /etc/systemd/system/ for things you create or override, and in /lib/systemd/system/ for things shipped by packages. Never edit the files in /lib/systemd/system/ directly — a package update will overwrite them. Copy the unit to /etc/systemd/system/ and edit the copy, or use systemctl edit nginx to create an override file. After changing a unit file, always run systemctl daemon-reload, or systemd keeps using the old copy it loaded into memory and your change silently does nothing.
journalctl: the logs systemd keeps
systemd collects the output of the services it manages in the journal, and journalctl reads it:
journalctl -u nginx journalctl -u nginx -f journalctl -u nginx --since "1 hour ago" journalctl -u nginx -n 100 --no-pager journalctl -p err --since today
journalctl -u nginx -f follows a service’s log live, like tail -f. –since “1 hour ago” limits the output to recent entries — essential on a busy server, where the full journal can be enormous. journalctl -p err shows only errors and worse, across all services, which is a good first look at a server you have just logged into. Add -o short-iso if you want timestamps you can sort and compare, and –no-pager when you are piping output into another command.
Networking — Addresses, Ports, DNS and Firewalls
A DevOps engineer spends a surprising amount of time on networking, and almost all of it is answering three questions: can this machine reach that machine, is anything listening on this port, and is DNS resolving this name?
Addresses and routes
The modern command for network interfaces is ip, from the iproute2 package. The older ifconfig is deprecated on most distributions and may not even be installed:
ip addr show ip addr ip route show ip link show
ip addr show lists every interface with its IPv4 and IPv6 addresses. ip route show shows the routing table, including the default gateway — the address traffic leaves through when it has nowhere more specific to go. If a server cannot reach the internet, check these two commands first: a missing address or a missing default route explains most “no network” incidents.
Listening ports
ss is the modern replacement for netstat, and it answers the most common networking question in DevOps: what is listening on this port?
ss -tulpn ss -tlnp ss -s
ss -tulpn shows TCP and UDP listening sockets with the process name and PID that owns each one (-p needs root or the process owner to show process names). The flags are worth memorising: -t for TCP, -u for UDP, -l for listening sockets only, -p for the process, -n to skip DNS lookups so the output is fast. If your application should be listening on port 8080 and ss -tlnp does not show it, the application is not running or not bound to that port — check systemctl status and the application log before blaming the firewall.
Reaching services and checking DNS
curl is the Swiss army knife for testing HTTP services:
curl -I https://example.com curl -v https://example.com/health curl --max-time 5 https://example.com
curl -I fetches only the headers — a fast way to check whether a service answers at all. -v shows the connection, TLS handshake and headers, which is what you want when a request fails in a way a browser would hide. –max-time 5 stops curl hanging forever on an unresponsive host; always set a timeout in scripts.
For DNS, use getent or dig:
getent hosts example.com dig example.com +short dig example.com
getent hosts uses the system’s normal name resolution, including /etc/hosts, so it shows you what applications on this machine actually see. dig talks directly to DNS and shows the full answer, including which server answered and how long the record lives. Check /etc/resolv.conf to see which DNS servers the system is using, and /etc/hosts for local overrides that can silently redirect a name.
Firewalls
Linux has two common firewall front ends. Ubuntu and Debian use ufw (Uncomplicated Firewall); Red Hat Enterprise Linux, Fedora and Rocky Linux use firewalld. Both sit on top of the kernel’s packet filtering, and both default to blocking incoming traffic that you have not explicitly allowed:
sudo ufw status verbose sudo ufw allow 22/tcp sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw enable
sudo firewall-cmd --list-all sudo firewall-cmd --add-service=http --permanent sudo firewall-cmd --add-service=https --permanent sudo firewall-cmd --reload
With firewalld, –permanent writes the rule to disk, and –reload applies the permanent configuration — a rule added without –permanent disappears at the next reload. The classic incident pattern is: the application is running, ss shows it listening, curl localhost works on the server, but nothing can reach it from outside. That is almost always the firewall, and ufw status or firewall-cmd –list-all confirms it in seconds. Open exactly the ports you need, and no more — port 22 for SSH, 80 and 443 for a web server, and the application’s own port only if something outside the server genuinely needs it.
Users, Permissions and SSH — Who Can Do What
Most Linux security incidents are permission incidents. The model is simple — every file has an owner, a group, and three sets of permissions (read, write, execute) for owner, group and everyone else — but getting it wrong locks people out or, worse, lets the wrong people in.
Permissions
ls -l /var/www/html chmod 755 deploy.sh chmod 600 ~/.ssh/id_ed25519 chmod 644 config.yaml chown deploy:deploy /var/www/html chown -R www-data:www-data /var/www/html
chmod 755 (owner can read, write and execute; everyone else can read and execute) is the standard for scripts and directories. chmod 644 is the standard for files that should be readable but not executable. chmod 600 — owner read and write only — is the standard for private keys and credential files, and SSH will refuse to use a private key that is more permissive than that. chown changes ownership; -R applies it recursively. A common DevOps mistake is running a deployment as root and leaving files owned by root in a directory the application user needs to write to — the application then fails with a permission error that looks like an application bug. Check ownership with ls -l before debugging the application.
sudo runs a command as root (or another user) without logging in as root:
sudo systemctl restart nginx sudo -u www-data whoami sudo -l
sudo -l lists what the current user is allowed to run with sudo. The rule for production servers is least privilege: give each person and each service account only the permissions it needs, and never run an application as root when a dedicated user will do.
SSH keys
Password logins are the weak point of most servers. SSH key authentication replaces them:
ssh-keygen -t ed25519 -C "deploy@example.com" ssh-copy-id deploy@203.0.113.10 ssh -i ~/.ssh/id_ed25519 deploy@203.0.113.10
ssh-keygen -t ed25519 creates a key pair: a private key that never leaves your machine, and a public key that goes on the server. ssh-copy-id copies the public key into the server’s ~/.ssh/authorized_keys. The permissions on the server side matter and are enforced: ~/.ssh must be 700, and authorized_keys must be 600, or SSH will ignore the key and fall back to asking for a password:
chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys
On a server you manage, disable password authentication in /etc/ssh/sshd_config once key login works — set PasswordAuthentication no, then systemctl reload sshd. Test from a second terminal before closing your current session: if the configuration is wrong, the open session is your way back in.
Filesystems, Disk and Logs — Where Things Live and What Fills Up
“Disk full” is one of the most common causes of a service failing, and one of the easiest to prevent — if you know where to look.
Disk space
df -h df -h /var du -sh /var/log/* du -h --max-depth=1 /var | sort -h lsblk
df -h shows free space per filesystem, in human-readable units. The -h flag matters: without it, the numbers are in 1K blocks and easy to misread. Check the percentage used, not just the free space — a filesystem at 100% will break writes, and many services fail in confusing ways when they cannot write. du -sh shows how much space a directory uses; du -h –max-depth=1 /var | sort -h finds which top-level directory under /var is growing. Nine times out of ten, the answer is /var/log or /var/lib/docker.
lsblk lists block devices and their mount points — useful when a disk has been attached but not mounted, or when you need to confirm which device a filesystem lives on. mount and findmnt show what is currently mounted and with which options; a filesystem mounted read-only will produce permission errors that look like ownership problems until you check.
Logs
Linux keeps logs in two places: the systemd journal (covered above) and plain text files under /var/log. The files you will read most:
tail -f /var/log/syslog tail -f /var/log/auth.log tail -n 100 /var/log/nginx/error.log grep -i "error" /var/log/syslog | tail -n 20
Learn grep well — grep -i error, grep -c to count matches, grep -r to search a directory — because reading a whole log file by hand stops working the first time it is larger than your screen.
logrotate
Logs grow forever unless something trims them, and that something is logrotate. Its configuration lives in /etc/logrotate.conf and /etc/logrotate.d/. A typical configuration rotates a log daily, keeps a set number of old copies compressed, and creates a fresh file:
cat /etc/logrotate.d/nginx sudo logrotate -d /etc/logrotate.d/nginx
logrotate -d runs in debug mode — it shows what would happen without doing it, which is the safe way to test a new configuration. If a log file is growing without bound, check whether logrotate is configured for it and whether its timer is active (systemctl status logrotate.timer). A missing or broken logrotate configuration is the usual reason a server runs out of disk six months after it was set up.
Package Management and Shell Scripting as Glue
Servers need software installed, updated and removed — and the same few commands, wrapped in scripts, do most of the automation in a DevOps workflow.
Package management
Ubuntu and Debian use apt; Red Hat Enterprise Linux, Fedora and Rocky Linux use dnf (older systems use yum, which dnf replaced). The workflows are parallel:
sudo apt update sudo apt upgrade -y sudo apt install -y nginx htop curl sudo apt remove nginx sudo apt list --upgradable
sudo dnf check-update sudo dnf upgrade -y sudo dnf install -y nginx htop curl sudo dnf remove nginx
apt update refreshes the list of available packages; it installs nothing. apt upgrade installs newer versions of what is already there. Running upgrade without update first upgrades nothing, because the package list is stale. On a production server, run updates in a maintenance window, not in the middle of the day, and prefer unattended security updates for the packages that matter: on Ubuntu, the unattended-upgrades package does this; on Red Hat systems, dnf-automatic does the same job.
Shell scripting as glue
Shell scripting is the glue between everything in this article. A script that checks a service, restarts it if it is down, and logs what it did is ten lines long and genuinely useful:
#!/usr/bin/env bash set -euo pipefail SERVICE="nginx" LOG_FILE="/var/log/service-watch.log" if systemctl is-active --quiet "$SERVICE"; then echo "$(date -Iseconds) $SERVICE is running" >> "$LOG_FILE" else echo "$(date -Iseconds) $SERVICE is down, restarting" >> "$LOG_FILE" systemctl restart "$SERVICE" fi
Three habits make scripts like this reliable. First, set -euo pipefail: exit on any error, treat unset variables as errors, and fail a pipeline if any part of it fails. Without it, a script keeps running after a command fails and reports success. Second, quote your variables — “$SERVICE”, not $SERVICE — so a value with a space in it cannot split into two arguments. Third, use shellcheck on every script before you trust it.
Daily Workflow — Debugging a Service That Will Not Start
Here is the workflow that ties everything in this article together. A web service is down. Work through it in order, and do not skip steps — each one rules out a whole class of causes.
1. Is the service running?
systemctl status nginx --no-pager systemctl list-units --failed
If the service is failed, systemctl status shows the exit code and the last log lines. If it is inactive, it may simply never have been started — or never enabled, in which case it stopped at the last reboot.
2. What do the logs say?
journalctl -u nginx -n 100 --no-pager tail -n 100 /var/log/nginx/error.log
Read the most recent errors first. A configuration error will usually name the file and line number. A port conflict will say the address is already in use. A permission error will say which file it could not read.
3. Is anything listening?
ss -tlnp | grep 80 curl -I http://localhost
If ss shows nothing on port 80, the service is not bound to the port — it either failed to start or is configured to listen somewhere else. If curl localhost works but the service is unreachable from outside, the problem is the firewall or the cloud security group, not the service.
4. Is the system healthy?
df -h free -h ps aux --sort=-%mem | head -n 10
A full disk, exhausted memory, or a runaway process can all stop a service from starting. free -h shows memory use; ps aux –sort=-%mem shows the ten hungriest processes. If the disk is full, find what is filling it with du before deleting anything — deleting the wrong log can destroy the evidence of what went wrong.
5. Fix it, verify it, and make it stay fixed.
sudo nginx -t systemctl restart nginx systemctl is-active nginx systemctl is-enabled nginx
nginx -t tests the configuration before you restart, so a typo does not take the service down a second time. After the restart, confirm the service is active, confirm it is enabled for boot, and confirm it answers with curl. Then fix the root cause — the logrotate configuration, the disk cleanup, the configuration error — so the same failure does not happen after the next reboot. A service that was fixed by hand and not fixed at the root is a service that will page you again.
FAQ
Do I need to learn Linux to work in DevOps?
Yes, in practice. The servers, containers, CI runners and cloud instances you will manage all run Linux, and the tools you will use — Docker, Kubernetes, Terraform, Ansible — all assume you can work on a Linux command line. You do not need to be a kernel developer, but you do need the skills in this article: processes, services, networking, permissions, disk and logs.
Which Linux distribution should I learn first?
Ubuntu 24.04 LTS is the best starting point for most people: it is the most common distribution in cloud environments, it has the largest body of documentation, and its long support window — standard security maintenance until May 2029 — means what you learn now stays current. Red Hat Enterprise Linux and its rebuilds are the standard in large enterprises, so learn dnf and firewalld once you are comfortable with apt and ufw. The concepts transfer; only the package and firewall commands change.
Is systemd on every Linux distribution?
Almost every major server distribution uses systemd as its init system, including Ubuntu, Debian and Red Hat Enterprise Linux. A few specialist distributions use alternatives, but for DevOps work you can assume systemd: systemctl and journalctl are the commands to learn.
What is the difference between kill and kill -9?
kill sends SIGTERM, which asks the process to shut down cleanly — closing files and finishing what it is doing. kill -9 sends SIGKILL, which the kernel enforces immediately and the process cannot ignore. Use kill first and give the process a few seconds; use kill -9 only when the process does not respond to SIGTERM.
How do I stop a server running out of disk?
Find what is growing with du -h –max-depth=1, fix the cause — usually an unrotated log file or an old Docker image — and make sure logrotate is configured and its timer is active. Set up disk monitoring with an alert at 80% full, so you hear about growth before it becomes an outage.
Conclusion
Linux is not a subject to study once and forget; it is the environment DevOps work happens in. The skills in this article — reading processes, managing services with systemd, checking ports and DNS, setting permissions, watching disk and logs, installing packages and gluing it together with a shell script — are the skills you will use on your first day and your thousandth. They are also the skills that turn an outage from a panic into a procedure: check the service, read the logs, check the port, check the system, fix the cause.
Learn them on a real server, not just by reading. Set up an Ubuntu 24.04 LTS machine, install nginx, break its configuration on purpose, and work through the debugging workflow above until each step is automatic. Then add the next layer — our Linux Shell Scripting Tutorial for automation, and our Python for DevOps Tutorial for the tasks that outgrow the shell.
Sources checked 28 Nov 2026: Ubuntu release cycle (ubuntu.com — Ubuntu 24.04 LTS, released April 2024, standard security maintenance to May 2029, expanded security maintenance with Ubuntu Pro to May 2034); Linux man-pages project (man7.org — ps, top, kill, nice, systemctl, journalctl, ip, ss, curl, chmod, chown, ssh-keygen, df, du, logrotate, apt and dnf command syntax and flags); systemd is the standard init system on Ubuntu, Debian and Red Hat Enterprise Linux. External references: Ubuntu release cycle · Linux man-pages project.
—



