Understanding the power of Linux, as a Windows user
Coming from the perspective of a Windows user, Linux may seem entirely alien under the surface. Windows favors a batteries-included, gui driven workflow where programs tend to be all inclusive. Linux favors a command line driven workflow, where only the basics are available, and programs are small and meant to be chained together.
This disparate approach is due to many differences, but there are two main ones at play. The first is the design of the kernel, the heart of the operating system. Windows favors a hybrid kernel which incorporates some features into the heart of the operating system directly and some features outside the direct kernel being heavily necessary. Linux on the other hand favors a unikernel approach which contains everything for a valid (but not very useful) operating system.
The minimal things required to get a windows kernel to boot is a daunting list of software, drivers, registries, and so on. The minimal things required to get a linux kernel to boot are a userland of some sort (a package of basic programs, about 4kb), and a bootloader. Obviously the typical user will want their linux install to include many more things like networking utilities, web browsers, games, etc - but those are layered on top according to need.
This is what allows Linux to come in such specialty packages (called distributions) which allow it to be uniquely targeted for a task. Running a server? There are several distros which include a pre-fortified configuration, with the right mix of drivers for most enterprise hardware and not much else. Want to bootstrap a media server? There’s a distro for that focused on media codecs, web control panels, working with a local NAS device, etc. Want to build your own retro arcade? There’s a.. ok, you get the idea.
Windows on the other hand comes in four vague flavors: S for a locked down experience, Home for most users, Pro for offices and Server for, well, your server. Need to run a home media center or build a gaming desktop? Well, both Home and Server will do that.. if you fight with them - but it won’t be specialized for them. Yeah, your webserver that does nothing but host SQL all day will have media codecs installed and image viewers, while your gaming rig will have an active directory client.
Filesystems and blobs
On Windows, we have files and folders, and they sit inside a hard drive which is an abstraction of the operating system. We have the registry, which is a key and value store. We have drivers, which live in the Driver Store (which is kind of on the filesystem but is kind of different too). Devices themselves are around, somewhere floating in the ether, and it’s up to the driver to figure out how to expose that. Memory is accessible through API calls but otherwise a black box.
On Linux, everything is a file. Your files are files. Want to see what’s in memory? That’s a file. Get an idea of your CPU sleep states currently enabled? That’s a file. Want to talk to a usb drive at low level or push raw pixels to your monitor? That’s still just a file.
Thus, if you want to get an idea of logs in realtime, or communicate with a database without using network ports, you can simply do so by reading and writing from a file. Many of the files I mention are slightly different from a regular text file - they are streams, which is a fancy file that hasn’t ended (yet). You can just keep reading at it and there can be new content.
Since everything is just a file, our normal file programs will work on most things. We can get the contents of memory with
cat just as we’d get the contents of a text file. We can save memory blocks back to disk with
cp and we can even change our firewall with nothing more than our favorite editor.
This is the power of Linux. Whether you want to move some files around or copy a chunk of memory to a usb drive to debug later, it’s the same commands. A small, portable toolbox ends up going a long way while still giving you a powerful customized system that can be slimmed down or bulked up as needed. The same tools you use to search a file can be used on memory, and the same tool you use to search through a directory can iterate over your devices.
Small, composable tools in an environment suited for the task.