Learning Modern Linux
by Michael Hausenblas
Copyright 2022 Michael Hausenblas. All rights reserved.
Printed in the United States of America.
Published by OReilly Media, Inc. , 1005 Gravenstein Highway North, Sebastopol, CA 95472.
OReilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://oreilly.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com.
- Acquisitions Editor: John Devins
- Development Editor: Jeff Bleiel
- Production Editor: Gregory Hyman
- Copyeditor: Piper Editorial Consulting, LLC
- Proofreader: Amnet Systems, LLC
- Indexer: WordCo Indexing Services, Inc.
- Interior Designer: David Futato
- Cover Designer: Karen Montgomery
- Illustrator: Kate Dullea
Revision History for the First Edition
- 2022-04-15: First Release
See http://oreilly.com/catalog/errata.csp?isbn=9781098108946 for release details.
The OReilly logo is a registered trademark of OReilly Media, Inc. Learning Modern Linux, the cover image, and related trade dress are trademarks of OReilly Media, Inc.
The views expressed in this work are those of the author and do not represent the publishers views. While the publisher and the author have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.
978-1-098-10894-6
[LSI]
Preface
A warm welcome to Learning Modern Linux! Im glad that we will walk thisjourney together for a bit. This book is for you if youve already been using Linuxand are looking for a structured, hands-on approach to dive in deeper,or if you already have experience and want to get sometips and tricks to improve your flow when working with Linuxfor example, ina professional setup, such as development or operations.
Well focus on using Linux for your everyday needs, from development tooffice-related tasks, rather than on the system administration side of things.Also, well focus on the command line, not visual UIs.So, while 2022 might be the year of Linux on the desktop after all, well use the terminal as the main way to interact with Linux. This has theadditional advantage that you can equally apply your knowledge in many differentsetups, from a Raspberry Pi to the virtual machine of your cloud provider ofchoice.
Before we start, Id like to provide some context by sharing my own journey:my first hands-on experience with an operating system was not with Linux. Thefirst operating system I used was AmigaOS (in the late 80s), and after that, in technicalhigh school, I mainly used Microsoft DOS and the then-new Microsoft Windows,specifically around the event system and user interfacerelated development.Then, in the mid- to late 1990s, during my studies at university, I mainlyused Unix-based Solaris and Silicon Graphics machines in the university labs. I really only got into Linux inthe mid-2000s in the context of big data and then when I started working with containers,first in 2015 in the context of Apache Mesos (working at Mesosphere), and thenwith Kubernetes (initially at Red Hat on the OpenShift team and then at AWS onthe container service team). Thats where I realized that one needs to master Linux to be effective in this space. Linux is different. Its background, worldwide community of users, and versatility and flexibility make it unique.
Linux is an interesting, ever-growing ecosystem of open source individuals andvendors. It runs on pretty much anything under the sun, from the $50Raspberry Pi to the virtual machines of your favorite cloud provider to a Mars vehicle.After 30 years in the making, Linux will likely stick aroundfor some time, so now is a good time to get into Linux a bit deeper.
Lets first set some ground rules and expectations. In the preface, Illshare how you can get the most out of this book as well as some administrative things,like where and how you can try out the topics well work through together.
About You
This book is for those who want or need to use Linux in a professionalsetup, such as software developers, software architects, QA testing engineers,DevOps and SRE roles, and similar roles. Ill assume that if youre a hobbyist encounteringLinux when pursuing an activity such as 3D printing or home improvement, you have very little to no knowledge about operating systems in general orLinux/UNIX in particular. You will get the most out of the book if you work throughit from beginning to end, as the chapters tend to build on one another; however,you can also use it as a reference if youre already familiar with Linux.
How to Use the Book
The focus of this book is enabling you to use Linux, not administer it. There areplenty of great books about Linux administration out there.
By the end of this book, you will understand what Linux is () are.
Then, youll get some hands-on experience with the Linux networkingstack and tooling () and howto apply it to manage your workloads.
Youll understand how to run Linux applications in modern ways by usingcontainers as well as immutable distros such as Bottlerocket and also how tosecurely communicate (download files, etc.) and share data using Secure Shell (SSH) andadvanced tooling like peer-to-peer and cloud sync mechanisms ().
Following are suggestions for ways you can try things out and follow along (and Istrongly recommend you do; learning Linux is like learning a languageyou want to practicea lot):
Get a Linux desktop or laptop. For example, I have a verynice machine called StarBook from Star Labs.Alternatively, you could use a desktop or laptop that no longer runs a recentWindows version and install Linux on it.
If you want to experiment on a different (host) operating systemsay, yourMacBook or iMacyou could use a virtual machine (VM). For example, on macOSyou could use the excellent Linux-on-Mac.
Use your cloud provider of choice to spin up a Linux-based VM.
If youre into tinkering and want to try out a non-Intel processorarchitecture such as ARM, you could buy a single-board computer such as thewonderful Raspberry Pi.
In any case, you should have an environment at hand and practice a lot. Dont just read: try out commands and experiment. Try tobreak things, for example, by providing nonsensical or deliberately strangeinputs. Before you execute the command, form a hypothesis about the outcome.
Another tip: always ask why. When you see a command or a certain output, tryto figure out where it came from and what the underlying component responsiblefor it is.
Conventions
The following typographical conventions are used in this book:
ItalicIndicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs torefer to program elements such as variable or function names, databases, datatypes, environment variables, statements, and keywords.