Linux Fundamentals: Permissions, Processes & systemd

Zusammenfassung

Pixel shares a practical guide to Linux fundamentals that underpin DevOps tools like Docker, Kubernetes, and Terraform. It explains file permissions and octal modes such as chmod 755, alongside processes, systemd, and command-line tools essential for troubleshooting.

DEV Community

Linux Fundamentals: What You Actually Need to Live Comfortably in a Terminal

Every DevOps roadmap, mine included, starts with "learn Linux" as step one, and it's tempting to treat that as a box to tick before getting to the "real" stuff — Docker, Kubernetes, Terraform. That's backwards. Every one of those tools is Linux underneath, running as processes, writing logs, respecting file permissions, managed by the same init system. This post is the actual foundation: permissions, processes, systemd, and the handful of command-line tools you'll reach for constantly once you're actually debugging something at 2am. Permissions: Who Can Do What to a File Everything in Linux is designed around one question: who is allowed to read, write, or execute this thing? Run ls -l on any file and the permission string at the start tells you the whole answer: -rwxr-xr-- 1 daemon devteam 4096 Aug 20 14:02 deploy.sh
Break that first block into four pieces: the file type (- for a regular file, d for a directory), then three groups of three characters — permissions for the owner, the group, and everyone else, in that order. Each group is r (read), w (write), x (execute), or - if that permission isn't granted. So rwxr-xr-- means: the owner can read, write, and execute; the group can read and execute but not write; everyone else can only read. Octal Notation — Why chmod 755 Means What It Means Each rwx triplet can be represented as a single number by treating r, w, and x as bit values — r = 4, w = 2, x = 1 — and adding up whichever ones are granted: Permission Value Read (r) 4 Write (w) 2 Execute (x) 1 rwx = 4+2+1 = 7. r-x = 4+1 = 5. r-- = 4 = 4. So chmod 755 deploy.sh sets owner to rwx (7), group to r-x (5), and everyone else to r-x (5) — a very common pattern for an executable script that everyone should be able to run but only the owner should be able to edit. chmod 644 (owner: read/write, everyone else: read-only) is the equivalent pattern for a regular non-executable file, like a config file. chmod 755 deploy.sh # owner: rwx, group: r-x, other: r-x
chmod +x deploy.sh # just add execute permission for everyone, without touching the rest
chmod u+w,g-w config.yml # owner gains write, group loses write
Ownership: chown and chgrp Permissions only mean anything relative to who actually owns the file. chown changes the owning user (and optionally the group in the same command); chgrp changes just the group: sudo chown daemon:devteam deploy.sh # owner: daemon, group: devteam
sudo chown -R daemon:devteam /var/www/app # recursively, for every file in a directory
The -R flag matters constantly in real work — a misconfigured deploy that leaves files owned by root when your application runs as a non-root user is one of the most common "why won't my app start" issues you'll hit, and it's always a chown -R fix once you know what to look for. sudo vs. su sudo runs a single command with elevated privileges, then drops back to your normal user immediately after. su switches your entire shell session to another user (root, by default, if no username is given) until you explicitly exit that session. In almost all modern practice, sudo is the better habit — it's scoped to exactly the one command that needs elevation, it's logged per-command, and it doesn't leave you sitting in a root shell longer than necessary, which is exactly the kind of thing that turns a typo into a real incident. Processes: What's Actually Running A process is a running instance of a program, and Linux gives every single one a PID (Process ID) the moment it starts. Everything you'll ever debug on a server eventually comes down to "what process is doing this, and what state is it in." ps aux # every process running on the system, in detail
ps aux | grep nginx # just the ones matching "nginx"
top # live, auto-refreshing view of processes by CPU/memory usage
htop # the same idea, with a much friendlier interface (install it, it's worth it)
ps aux output tells you the user running each process, its PID, ...
Linux Fundamentals: Permissions, Processes & systemd
Powered by Readybot.io

Das Neueste von Pixel

Incident Response: Look Beyond the Red Alert

Pixel’s DEV Community announcement explores how teams can fixate on one failing service while overlooking the real cause of an outage, such as a full …

Sach: AI Fact-Checks WhatsApp Forwards in India

Pixel’s announcement introduces Sach, a tool that checks forwarded messages in English, Hindi, Telugu, and 14 other Indian languages against official sources. It gives cited …

Java 25 Removes SecurityManager: What to Fix

Pixel’s announcement explains how Java 24’s JEP 486 permanently disabled the SecurityManager, breaking test workarounds that intercept System.exit. It recommends returning exit codes or throwing …