InfraMaxx

Track

Linux & OS Internals lessons

85 short lessons on Linux & OS Internals. Each one starts from a real situation, shows how it works, and ends with a quiz. Free to read.

Start with the first lesson

All 85 lessons

  1. What an operating system doesBeginner · 5 min

    Your program never touches the disk, the network card or the RAM chips. Something else does it for them, and that something decides who waits.

  2. The terminal, the shell and your first commandsBeginner · 5 min

    Learn how the terminal and shell work together, and how to read and enter commands.

  3. Finding answers: man, --help and tldrBeginner · 4 min

    Nobody remembers every flag. The engineers who look calm in an incident are the ones who know which of three tools answers which kind of question.

  4. The Linux file system hierarchy: /, /etc, /var, /home, /usrBeginner · 5 min

    Config, logs, programs and your own files each have a standard home. Learn the five or six that matter and you can find almost anything on an unfamiliar server.

  5. Paths: absolute, relative, ., .. and ~Beginner · 5 min

    The same command works in one folder and fails in another. The difference is almost always how you wrote the path.

  6. Create, copy, move and delete files without losing dataBeginner · 5 min

    Learn how copying, moving and deleting files affect existing data, and how to check a command before running it.

  7. Reading and editing files: cat, less, tail -f, nano, vimBeginner · 5 min

    Most of an operator's day is reading a log or changing one line of config over SSH. Pick the right viewer, and learn how to leave an editor without losing your work.

  8. Inodes, hard links and symbolic linksBeginner · 5 min

    A file name is not the file. Once you see that a name is only a label pointing at an inode, links, deleted files that still use space, and out-of-inodes errors all make…

  9. Users, groups and /etc/passwdBeginner · 5 min

    The kernel does not know the word alice. It knows the number 1000. Seeing how names map to numbers explains who owns what, and why a new group takes effect only at your…

  10. Permissions: read, write, execute and chmodBeginner · 5 min

    Ten characters at the start of ls -l decide who can read, change or run a file. Read them once properly and most Permission denied tickets answer themselves.

  11. Ownership: chown, chgrp and why a directory needs the x bitBeginner · 5 min

    Permissions say what each class may do. Ownership decides which class you are. Directories add a twist: the x bit means enter, and without it the file inside is…

  12. Root, sudo and least privilegeBeginner · 5 min

    Root has broad privileges, including the ability to delete important files. sudo lets you borrow that power one command at a time, and teaches the habit that later…

  13. Processes: PID, ps and topBeginner · 5 min

    Every incident starts with two questions: what is running, and who started it. Learn to answer both in under a minute, and what the columns mean.

  14. fork, exec and process statesBeginner · 5 min

    Every command you type starts with a copy of your shell, then a swap of the program inside it. That explains parents, children, exit codes and why cd is built in.

  15. Kernel space, user space and system callsBeginner · 5 min

    A program cannot write to a disk or open a network connection by itself. See the one door every program uses to ask the kernel, and how to watch it open.

  16. File descriptors, stdin, stdout and stderrBeginner · 5 min

    Every open file, socket and terminal is a small number inside a process. Three of them exist before the program starts, and one limit on them causes Too many open files.

  17. Pipes and redirection: pipe, >, >> and 2>&1Beginner · 5 min

    The shell can rewire a program's input and output without the program knowing. Learn the symbols, the order trap in 2>&1, and the one that erases your file.

  18. Searching text with grepBeginner · 5 min

    Finding the 42 lines that matter in a 180,000-line log is one command. Learn the options you will type every day, and the dot that matches more than you meant.

  19. One-liners with sort, uniq, cut, wc, awk and sedBeginner · 5 min

    Turn a 10,000-line log into the three numbers you need. Six small tools, one pipeline pattern, and the reason uniq without sort gives wrong counts.

  20. Finding files with find and xargsBeginner · 5 min

    Find the huge, old or world-writable file without opening every directory, then act on the result safely. Includes the quoting mistake that makes find return wrong…

  21. Environment variables, PATH and shell startup filesBeginner · 5 min

    A script works when you run it and fails from cron with command not found. The difference is the environment. Learn what it is, how PATH picks a program, and which…

  22. Package managers: apt, dnf and repositoriesBeginner · 5 min

    Why you never download a .exe on Linux: one command fetches, verifies and installs software, and one more tells you which package owns any file.

  23. systemd: units, systemctl and servicesBeginner · 5 min

    The first command an on-call engineer types on a dead server is systemctl status. Learn to read it, and to tell started from enabled.

  24. Logs: /var/log, journalctl and log rotationBeginner · 5 min

    "Check the logs" is not a plan until you know which file or command, and how to stop logs filling the disk.

  25. Scheduling work with cronBeginner · 5 min

    A cron job that works when you type it and fails at 3 a.m. almost always fails for one reason: cron does not run in your shell.

  26. Disk space: df, du, mounts and file system typesBeginner · 5 min

    A full disk kills more services than any bug. Learn the two commands that disagree on purpose, and where each directory actually lives.

  27. Memory: RAM, swap, virtual memory and the OOM killerBeginner · 5 min

    When a process vanishes with no error message of its own, the kernel often killed it on purpose. Here is how to prove it.

  28. CPU time and load averageBeginner · 5 min

    Load average looks like a CPU percentage and is not one. Read the three numbers correctly and you avoid a top-three Linux interview trap.

  29. Your first shell script: shebang, variables and quotingBeginner · 5 min

    A script is a list of commands saved in a file. Three habits, the shebang, variables and quotes, decide whether it works on any file name.

  30. if, for and while in BashBeginner · 5 min

    Make a script decide and repeat: test a file, loop over services, read a file line by line, and avoid the unquoted test that breaks on empty values.

  31. Exit codes and set -euo pipefailBeginner · 5 min

    By default a Bash script keeps going after a command fails. Learn how three shell options affect error handling, where their limits are, and how to clean up.

  32. Build a disk-and-service check script and schedule itBeginner · 5 min

    Combine five earlier lessons into one working job: test disk and services, exit non-zero on trouble, log with timestamps, run it every five minutes.

  33. Capstone: diagnose a broken server: disk, port, DNS, permissionsBeginner · 6 min

    Four faults hide behind one symptom. Work from the outside in, change one thing at a time, and let each fix reveal the next problem.

  34. From power-on to login: firmware, bootloader, kernel, systemdBeginner · 5 min

    A server reboots after a kernel update and never answers SSH. Four different programs run before the login prompt, and the last line on the console tells you which one…

  35. Writing a systemd unit: ExecStart, Restart and dependenciesBeginner · 5 min

    Your app runs from a terminal session, so it dies at reboot and nobody restarts it after a crash. A dozen lines of unit file fix both, and three details decide whether…

  36. systemd timers vs cron, and filtering the journalBeginner · 4 min

    Three servers run a nightly report from cron at 02:00, all hit the database in the same second, and a server that was off at 02:00 never ran it. Timers fix both, and…

  37. Reading top, htop and ps: VIRT, RES and state DBeginner · 5 min

    A load average of 18 on a 4-core server whose CPU is almost idle, and six processes you cannot kill. Every number in the top header and every letter in the state column…

  38. Finding the bottleneck: vmstat, iostat and the USE methodBeginner · 5 min

    The ticket says 'the app is slow' and four people suggest four different causes. Three questions asked of each resource in turn, utilization, saturation and errors…

  39. OOM kills: reading dmesg and oom_scoreBeginner · 5 min

    A service vanished at 03:12 and its own log ends mid-sentence. A signal it could not catch ended it, and the kernel wrote down who, why and how much memory it held.

  40. strace and lsof: what is this process doing?Beginner · 5 min

    A worker hangs at 0% CPU, writes no log and does not crash. Two commands show the exact system call it is stuck in and which connection or file that call is waiting on.

  41. File systems, fstab, LVM and growing a diskBeginner · 5 min

    You enlarged a cloud volume from 100 GB to 200 GB and df still says 100G. The new space has to be passed up through each layer, and the order of the layers is the whole…

  42. Limits and kernel parameters: ulimit and sysctlBeginner · 5 min

    A web server on a 64 GB host logs 'Too many open files' at 1,000 connections. A per-process limit stops it, and the fix lives in the unit file, not in the shell you…

  43. Host firewalls: ufw, iptables and nftablesBeginner · 5 min

    The app listens on 8080, the security group allows 8080, and curl from another instance still times out. A second firewall inside the host is dropping the packets, and…

  44. Shell functions, arguments and getoptsIntermediate · 6 min

    Six scripts share one copy-pasted disk check, and a bug fixed in five of them is still live in the sixth. Functions and getopts turn pasted code into one tool with…

  45. JSON on the command line: curl and jqIntermediate · 5 min

    Cloud tools, Kubernetes and web APIs all answer in JSON, and grep cannot read it. One filter language and two curl flags turn a 3,000-line response into the three names…

  46. PID namespaces: why the PID differs inside a containerBeginner · 5 min

    Inside the container nginx is PID 1; on the host the same process is 48213. Both numbers are right, and mixing them up sends kill to the wrong process or leaves docker…

  47. Signals: SIGTERM, SIGKILL and killBeginner · 5 min

    kill -9 works every time, which is exactly the problem. See what a signal is, what a program does with SIGTERM, and why the order matters.

  48. Zombie and orphan processesBeginner · 5 min

    ps lists 31,000 entries marked defunct and new jobs cannot start. Learn what a zombie is, why kill -9 does nothing to it, and how it differs from an orphan.

  49. Process descriptorsBeginner · 5 min

    Each process has a file-descriptor table referencing open file descriptions, including files and sockets; descriptors are small integer handles, not the underlying file…

  50. cgroup memory limits: memory.max and exit code 137Beginner · 5 min

    A Java container with a 512 MiB limit restarts every few hours with exit code 137 while the host has 20 GB free. The limit is a file in a cgroup, and the evidence is in…

  51. memory.highBeginner · 4 min

    memory.high throttles memory use under pressure.

  52. memory.oom.groupBeginner · 4 min

    memory.oom.group controls group-wide OOM victim killing.

  53. Why "free" memory looks low: the page cacheBeginner · 5 min

    A 64 GB server shows 700 MB free and an alert fires. Nothing is wrong, and here is the field you should be alerting on.

  54. Network namespaces: reachable from the host, not from the containerBeginner · 5 min

    curl 10.0.0.5 works on the host and fails inside the container, and the host's routes and firewall look fine. The container has its own network stack with its own empty…

  55. TCP listen backlogBeginner · 5 min

    TCP listen backlog queues pending connection work.

  56. epollBeginner · 4 min

    epoll waits efficiently for I/O readiness.

  57. SO_REUSEPORTBeginner · 4 min

    SO_REUSEPORT allows multiple sockets to bind a shared local port.

  58. "No space left on device" with free spaceBeginner · 5 min

    The disk is only 41% full and writes still fail. The filesystem ran out of file records, not bytes.

  59. Debugging "Permission denied"Beginner · 5 min

    A file that shows -rw-r--r-- can still be denied. Learn the three checks the kernel makes, and the one command that shows which one failed.

  60. Mount namespacesBeginner · 4 min

    Mount namespaces provide isolated filesystem mount views.

  61. Process lifecycleBeginner · 4 min

    Explain how a process moves from creation to exit, why an exited child can stay as a zombie until its parent calls wait, and how orphans are handled.

  62. fork exec waitIntermediate · 4 min

    Explain how fork and exec create a new program, how the parent collects the child's status, and why an inherited descriptor can keep a port or pipe open.

  63. Threads and pthreadsIntermediate · 4 min

    Explain how threads share a process's memory and descriptors, why shared memory needs locks, and why a higher thread count does not speed up lock-bound work.

  64. CPU scheduling classesIntermediate · 4 min

    Explain how Linux picks the next thread by scheduling class, why real-time policies outrank normal ones, and what nice values change inside the normal class.

  65. Context switchingIntermediate · 4 min

    Explain what a context switch costs in CPU time, how voluntary and nonvoluntary switches differ, and how to read switch rates against a healthy baseline and the request…

  66. Run queuesIntermediate · 4 min

    Explain how the run queue holds ready tasks, how CFS picks the next one by virtual runtime, and why a long queue adds latency even when CPUs are not fully busy.

  67. NUMA localityIntermediate · 4 min

    Explain how NUMA nodes make memory access cost depend on location, how the local allocation policy places pages at first touch, and how to check and fix remote memory…

  68. Virtual memoryIntermediate · 4 min

    Explain how each process gets its own virtual address space, how pages are mapped on demand, and why VIRT and RES tell different stories about memory use.

  69. Page faultsIntermediate · 4 min

    Explain the difference between minor and major page faults, why a major fault stalls a thread on disk, and how to read the counts from a process or a timed run.

  70. Copy on writeAdvanced · 4 min

    Explain how a private file mapping shares pages until a write, how the write copies one page, and why writes rather than reads decide the memory cost of a shared model.

  71. OOM selectionAdvanced · 4 min

    Explain how the kernel scores processes when memory runs out, how oom_score_adj shifts that score so a process is protected or exposed, and how cgroup v2 kills a whole…

  72. cgroup v2 controllersAdvanced · 4 min

    Explain how cgroup v2 groups processes under one unified hierarchy, why a controller must be enabled per directory before children can use it, and how memory.max and…

  73. PID and user namespacesAdvanced · 4 min

    Explain how PID and user namespaces change what a process sees, why PID 1 handles signals differently, and how a user ID map ties root inside to an ID outside.

  74. Filesystem inodesAdvanced · 4 min

    Explain what an inode holds, how a name points to it, and why a filesystem can refuse new files while it still has free disk space.

  75. ext4 journalingAdvanced · 4 min

    Explain what ext4's journal protects, why the default data mode journals only metadata, and why an application must call fsync to make its own writes durable.

  76. File descriptorsAdvanced · 4 min

    Explain how file descriptors index a process's open files and sockets, how RLIMIT_NOFILE caps them, and why a leak shows as a slow climb to EMFILE.

  77. epoll readinessAdvanced · 4 min

    Explain how epoll registers descriptors once and returns only the ready ones, and how level-triggered and edge-triggered modes differ in what they report to the program.

  78. Unix signalsAdvanced · 4 min

    Explain how signals reach a process, why SIGKILL and SIGSTOP cannot be handled, why standard signals merge, and why a handler should only set a flag.

  79. systemd unitsAdvanced · 4 min

    Explain what a systemd unit describes, where its files are found, and how After, Requires and Wants set the start order and the dependencies between units.

  80. Capabilities and seccompAdvanced · 4 min

    Explain how capabilities split root into smaller rights, how the bounding set limits exec, and how seccomp filters the system calls a process can make.

  81. strace tracingAdvanced · 4 min

    Explain how strace uses ptrace to record a process's system calls, and read an unfinished call to find what a stuck process is waiting for without changing its code.

  82. perf profilingAdvanced · 4 min

    Explain how sampling with perf estimates where CPU time goes, why symbols and event types decide whether a profile can be trusted, and how to read the top of a report.

  83. eBPF observabilityAdvanced · 4 min

    Explain how eBPF programs are checked by the verifier, attached to kernel events and read through maps, so you can measure a live kernel path with less overhead than…

  84. PID and user namespaces: failure analysisAdvanced · 4 min

    Explain how user and PID namespaces map IDs and process numbers between a container and the host, so a permission or signal fault can be tied to the right side.

  85. Mount namespaces: operational verificationAdvanced · 4 min

    Explain how mount namespaces and propagation decide what each process sees in its file tree, and how to check a bind-mounted file for a stale inode after a host change.