Chapter 01Lesson 02~40 minutes

The Linux Kernel, User Space, and GNU Tooling

A Linux command may look simple, but it crosses several layers: the shell parses it, libraries prepare requests, the kernel performs privileged work, and devices or filesystems provide the result. This lesson makes that path visible.

BeginnerArchitectureHands-on lab

Learning objectives

By the end of this lesson

  • Explain why applications run in user space while the kernel runs with elevated privilege.
  • Describe system calls as the controlled interface between programs and the kernel.
  • Recognize the kernel subsystems most relevant to DevOps operations.
  • Distinguish GNU utilities, the shell, C libraries, and Linux-specific interfaces.
  • Inspect the running kernel, user-space tools, libraries, and virtual filesystems safely.

1. The kernel and user-space privilege boundary

The kernel runs in a privileged processor mode and owns direct control of memory mappings, devices, process scheduling, filesystems, network stacks, and security enforcement. Ordinary programs—including shells, web servers, package managers, and CI agents—run in user space with restricted privileges.

Kernel space

Trusted resource manager

Coordinates hardware and enforces isolation. A kernel defect can affect the whole machine.

User space

Applications and services

Programs receive isolated address spaces and must request privileged operations through defined interfaces.

Boundary

System calls

Controlled entry points let programs open files, create processes, allocate memory, and communicate over networks.

Why this matters operationally

A failure in a user-space service may be restarted independently. A kernel panic, driver failure, or global resource exhaustion affects the host itself and requires a different troubleshooting strategy.

2. From a shell command to the kernel

When you enter cat /etc/os-release, Bash does not read the disk directly. It resolves the command, creates a process, and that process asks the kernel to open and read the file.

The execution path of a Linux command
flowchart TD
  U["User or automation"] --> SH["Shell parses command"]
  SH --> EX["Executable starts in user space"]
  EX --> LIB["Libraries prepare requests"]
  LIB --> SC["System calls cross privilege boundary"]
  SC --> K["Kernel subsystems"]
  K --> FS["Filesystem, network, memory, or device"]
  FS --> K --> EX --> U

Common system calls include openat, read, write, close, fork/clone, execve, mmap, socket, and connect. You normally use higher-level commands and libraries rather than invoking system calls directly.

3. Kernel subsystems DevOps engineers encounter

SubsystemResponsibilityOperational evidence
SchedulerChooses which runnable task receives CPU timeps, top, /proc/loadavg
Memory managerVirtual memory, page cache, allocation, and reclaimfree, vmstat, /proc/meminfo
VFS and filesystemsUniform file interface over ext4, XFS, tmpfs, and othersfindmnt, df, /proc/mounts
NetworkingInterfaces, routing, sockets, TCP/IP, filteringip, ss, /proc/net
Process and isolationPIDs, credentials, namespaces, cgroups, signalsps, /proc, systemd-cgls
Device modelDrivers and device exposure/dev, /sys, dmesg

4. GNU tooling, shells, libraries, and non-GNU components

A typical Linux distribution combines software from many projects. GNU contributes Bash, the GNU C Library on many distributions, Coreutils, Findutils, Grep, Sed, Gawk, Binutils, GCC, and other foundational tools. Linux itself is the kernel. Projects such as systemd, OpenSSH, util-linux, BusyBox, musl, LLVM, and many desktop or server components have separate origins.

Shell

Bash

Parses interactive commands and scripts, performs expansion and redirection, and launches programs.

Utilities

GNU Coreutils

Provides common commands such as ls, cp, mv, cat, and sort on many systems.

Library

glibc or alternatives

Offers standard C interfaces and wrappers around many kernel system calls. Alpine Linux commonly uses musl instead.

Minimal systems

BusyBox

Combines many utilities into one compact executable and is common in embedded systems and small containers.

Portability warning

Do not assume every Linux host uses GNU implementations. Command flags can differ across BusyBox, BSD-derived tools, and other user-space environments.

5. The operational interfaces: /proc, /sys, and /dev

  • /proc: a virtual view of processes and kernel state. Files such as /proc/cpuinfo, /proc/meminfo, and /proc/<pid> expose live information.
  • /sys: the sysfs interface for devices, drivers, kernel objects, and selected configuration attributes.
  • /dev: device nodes and special endpoints such as /dev/null, /dev/zero, terminals, disks, and pseudo-devices.

These paths look like ordinary files, but many are generated dynamically by the kernel. Reading is often safe; writing can change live system behavior and may require elevated privileges.

6. Inspect the layers on your machine

# Kernel identity and build information
uname -srmo
cat /proc/version

# Shell and command resolution
printf 'Login shell: %s\n' "$SHELL"
printf 'Current process: '
ps -p $$ -o comm=
type -a ls
command -V cat

# User-space implementation versions
ls --version 2>/dev/null | head -n 1 || true
bash --version | head -n 1
getconf GNU_LIBC_VERSION 2>/dev/null || true
ldd --version 2>&1 | head -n 1 || true

# Kernel-provided virtual interfaces
head -n 8 /proc/meminfo
ls -ld /proc /sys /dev

If ls --version fails, you may be using BusyBox or another non-GNU implementation. That is useful information, not an error in Linux itself.

7. Hands-on lab: build a kernel and user-space inventory

This lab creates a report without changing system configuration. It conditionally uses strace when available.

lab="$HOME/devops-academy/linux/chapter01/lesson02"
mkdir -p "$lab"
cd "$lab"

{
  printf '=== kernel ===\n'
  uname -a
  cat /proc/version

  printf '\n=== shell and utilities ===\n'
  bash --version | head -n 1
  command -V ls
  ls --version 2>/dev/null | head -n 1 || printf 'ls has no GNU-style --version output\n'

  printf '\n=== C library ===\n'
  getconf GNU_LIBC_VERSION 2>/dev/null || ldd --version 2>&1 | head -n 1 || true

  printf '\n=== virtual filesystems ===\n'
  findmnt -n -o TARGET,FSTYPE /proc /sys /dev 2>/dev/null || mount | grep -E ' on /(proc|sys|dev) '
} > layer-report.txt

if command -v strace >/dev/null 2>&1; then
  strace -o uname.trace -e trace=execve,openat,read,write,close uname -s >/dev/null
  printf 'System-call trace saved to %s/uname.trace\n' "$lab"
else
  printf 'strace is not installed; the main report is still complete.\n'
fi

less layer-report.txt

Verification checklist

8. Common misconceptions

“GNU/Linux means every component is GNU.”

No. It describes an important combination, but distributions integrate software from many independent projects.

“A command talks directly to hardware.”

Most commands operate through libraries and kernel interfaces. Device access is mediated by drivers and permissions.

“Everything under /proc is stored on disk.”

/proc is a virtual filesystem generated from live kernel and process state.

“All Linux commands support the same flags.”

User-space implementations differ. Automation should verify tool availability and required options.

9. Knowledge check

Question 1. Why can an ordinary process not directly control arbitrary physical memory or devices?

Question 2. What role does a system call play?

Question 3. Why might ls --version fail on a valid Linux system?

10. Summary

The kernel owns privileged resource management; user-space programs request services through system calls. A complete Linux environment combines the kernel with shells, libraries, service managers, and utilities from GNU and many other projects. DevOps engineers diagnose systems by connecting observed commands and files to the layer that produced them.

Next lesson

Linux Distributions and Release Models

Next, you will compare distribution families, package ecosystems, lifecycle policies, and stable versus rolling release strategies.

11. Further reading

  • Linux kernel documentation — core APIs, administration guides, and subsystem documentation.
  • Linux man-pages project — system calls, library calls, and Linux-specific interfaces.
  • GNU Coreutils manual — behavior of foundational GNU command-line utilities.
  • GNU C Library manual — user-space library interfaces and system integration.
  • proc(5), sysfs(5), and hier(7) manual pages — virtual interfaces and filesystem conventions.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0 Send only Ethereum/ERC-20 compatible assets to this address.