
Exit Codes and Conventions for Unix Tools
What exit status 0, 1, 2, 126, 127 and 128 plus a signal number mean on Linux, how a shell reads them, and which codes your own command-line tool should return.
Tag
82 posts

What exit status 0, 1, 2, 126, 127 and 128 plus a signal number mean on Linux, how a shell reads them, and which codes your own command-line tool should return.

Find every network interface on Linux 6.12 and the kernel driver behind it with ip link and ethtool -i, and read the same facts from sysfs for scripts.

Learn what Linux namespaces are, the eight kinds the kernel has, how to see them under /proc and how containers combine them to give a process its own view.

Fix the Too many open files error on Linux. Read RLIMIT_NOFILE, raise the soft limit in C, set systemd LimitNOFILE, and find the leak that caused it.

Open files with O_CLOEXEC so exec closes them automatically. Shows the leak into a child, the race with fcntl, and the flags for socket, pipe2 and dup3.

Where the Linux 6.12 firmware loader searches for blobs, in what order, how initramfs and built-in firmware fit in, and how to read the failure messages.

Compare the deprecated /sys/class/gpio interface with the libgpiod character device on Linux 6.12: ownership, atomic access, events and numbering.

List the files a Linux process has open with ls -l /proc/PID/fd, read fdinfo for offsets and flags, and use lsof for whole-system questions, with a C version.

A file descriptor points to an open file description, which points to an inode. See which layer holds the offset, flags and data, with dup and fork demos.

Give a process its own root filesystem using CLONE_NEWNS, a private mount propagation and the pivot_root system call on Linux 6.12, with a complete C program.

Start a process that sees itself as PID 1 using clone with CLONE_NEWPID or unshare plus fork on Linux 6.12, and learn why unshare never moves the caller.

Use lspci -k on Linux 6.12 to see the kernel driver in use and the modules that could drive each PCI device, and read the same answer from sysfs and modalias.