REVIEW - How Linux Works, 2nd Edition - What Every Superuser Should Know

Title:

How Linux Works, 2nd Edition - What Every Superuser Should Know

Author:

Brian Ward

ISBN:

9781593275679

Publisher:

No Starch Press (2014)

Pages:

392pp

Reviewer:

Ian Bruntlett

Reviewed:

September 2018

Rating:

★★★★★

This book describes itself as ‘What Every Superuser Should Know’. I read it very studiously, making notes and occasionally branching out to other books (in particular Networking for Systems Administrators by Michael W. Lucas) and reading relevant man and info pages. It acts as a framework for my Linux knowledge, with a view to adding to it. ☺

Structurally, it has 17 chapters, a Bibliography and a reasonable index.

Chapter 1, ‘The Big Picture’, gives an overview of things. Useful info for people who don’t have low-level knowledge of their computers or who gained their low-level knowledge on other systems.

Chapter 2, ‘Basic Commands and Directory Hierarchy’, covers the use of fundamental filehandling and other frequently used commands, shell globbing and, very helpfully goes into Unix matters like dot files, environment vs shell variables, special characters, I/O redirection, process manipulation, file modes and permissions, symbolic links, archive files, an overview of the Linux filesystem hierarchy and the use of sudo to run commands with superuser privileges.

Chapter 3, ‘Devices’, explains how the ‘everything is a file’ idea is useful in Linux. It covers the basics (which is all most people will ever need to know) and goes into detail which is interesting. I particularly enjoyed the explanation of the Linux SCSI subsystem and how it is co-opted to handle USB devices as well.

Chapter 4, ‘Disks and Filesystems’, builds upon Chapter 3, going into much more technical information which might be of interest to someone wanting to do kernel things.

Chapter 5, ‘How the Linux Kernel Boots’ discusses how a PC typically starts up from the BIOS running until user space (i.e. init) starts. Boot loaders are discussed but the lion's share of this covers GRUB – from a gentle introduction to writing your own menu entries to installing GRUB by hand. The two different boot loaders (BIOS MBR, UEFI) are covered.

Chapter 6, ‘How User Space Starts’, covers init, runlevels, has 16 dense pages about systemd (which appears to be the successor to the old init). It also covers the old init and, upstart (which I believe is no longer used). At the end it even covers the Initial RAM Filesystem.

Chapter 7, ‘System Configuration: Logging, System Time, Batch Jobs and Users’. Discusses the System Logger, how your hard drive doesn't get filled to overflowing with log files, the role of many of the strange configuration files in /etc – in particular /etc/passwd, /etc/group, how the login sequence works, Network Time. The cron system for scheduling regular tasks using cron, crontab and at. The various user ID types are discussed (Effective UID, Real UID and Saved UID). PAM – Pluggable Authentication Modules is also discussed.

Chapter 8, ‘A closer look at processes and resource utilization’ is a useful chapter – educational and of practical use when trying to track down performance problems. A variety of commands (lsof, strace, ltrace, ps, top, uptime, vmstat, iostat, pidstat) are explained.

Chapter 9, ‘Understanding your network and its configuration’ is a bold title for a bold chapter and chapters 10 and 12 build further on these foundations It asks two questions – ‘How does the computer sending the data know where to send its data?’ and ‘When the destination receives the data, how does it know what it just received?’ All the basics of networking (Packets, Network Layers, IP, subnets, routing, ping, traceroute, kernel network interfaces, NetworkManager, DNS, config files, TCP, UDP, DHCP, Linux as a Router, IP Masquerading, Firewalls, Ethernet, ARP WiFi) are covered.

Chapter 10, ‘Network Application and Services’ mainly covers TCP services and illustrates how to use telnet to interact with a webserver. The use of Secure Shell (SSH) and many of its uses. Diagnostic tools (netstat, lsof, tcpdump, netcat and nmap) are covered. RPC is covered, briefly. There is a good section on Network security. The role of TCP socket and Unix Domain sockets in handling applications on the localhost or other hosts is explained (liked it).

Chapter 11, ‘Introduction to shell scripts’ is the weakest chapter. It discusses the use of the Bourne Shell (sh) rather than the Bourne Again Shell (bash) which is a rather curious choice for a Linux command line interpreter. Despite that, it is a reasonable introduction to shell scripting, with the notable exception that it doesn't discuss debugging shell scripts. It does encourage the reader to use a scripting language like Python once a shell script has become too complicated and slow.

Chapter 12, ‘Moving files across the network’ builds on previous chapters, covering file and printer sharing (SimpleHTTPServer, rsync, SMB, NFS).

Chapter 13, ‘User Environments’. No, not GNOME – dot files and bash configuration files.

Chapter 14, ‘A Brief Survey of the Linux Desktop’ discusses different components. There is the desktop (Window Managers, Toolkits, Desktop Environments, Applications), a look at X and some related commands, the D-Bus message passing system and printing (CUPS).

Chapter 15, ‘Development Tools’ – quite important. Does a decent description of compiling C programs, covers static and shared libraries, make, debuggers, and mentions other scripting languages.

Chapter 16, ‘Introduction to compiling software from C source code’ does a reasonable job of explaining how to compile software distributed as open source. It covers make, GNU Autoconf, pkg-config, patch.

Chapter 17, ‘Building on the Basics’ is a ‘where next?’ chapter, asking (and answering) what to look at next.

I suspect that the 3rd edition of the book, if forthcoming, would cover systemd in more depth and use bash instead of sh.

Overall, I was thrilled with this book. It has consolidated some of my Linux knowledge and expanded other parts of it. Well worth reading.


Book cover image courtesy of Open Library.