For those short on time, here's a [NotebookLM](https://notebooklm.google.com/) one-click podcast created from this write-up.

# In general
> [!note]
> *This is a refresher for troubleshooting computers. Skip this if you’re pressed for time, but I recommend reading at some point.*
There’s the old adage that "[we taught rocks to think](https://jakec007.github.io/2020-06-28-how-we-trick-rocks-to-think/)." It’s not that far off, honestly. Computers are just a pile of sand (silicon) and metal coaxed into "thinking" through sheer wizardry. While the underlying magic like photolithography is fascinating, you don’t really need to know that for SA work. What *is* useful is knowing that all computers - whether they’re a laptop, a car’s ECU, or your smart fridge - work with the same basic components:
## Core components of all computers
> [!tip] If you can't find these, it's probably not a computer.
| Component | Role | Examples |
| ------------------ | ------------------------------------------------------ | --------------------------------------------------------------- |
| Processing (CPU) | The brain, processes data | Intel i9, AMD Ryzen, ARM Cortex, or a toaster's microcontroller |
| Volatile memory | Short-term storage, cleared on power off | RAM, CPU cache (L1, L2, L3), GPU video buffer |
| Long-term storage | Keeps data when power is off | HDD, SSD, ROM, flash storage |
| Power | Supplies energy to run the system | USB power, 12V adapter, 1,200W PSU, batteries |
| Heat management | Prevents overheating, dissipates excess heat | Fans, heat sinks, radiators |
| Input/Output (I/O) | Allows the system to communicate with external devices | USB, Ethernet, HDMI, PCIe slots, GPIO |
Computers all share these things, and the easiest way to understand them is like this:
Think of the CPU as the brain, RAM as its short-term memory (it forgets everything if you turn off the power), and storage as long-term memory where it writes down everything it needs to remember later.
> [!abstract] Heat
> Heat is just the consequence of trying to make rocks think faster than nature intended. It's inefficiency at its finest.
```mermaid
graph TD;
CPU-->RAM;
CPU-->Storage;
CPU-->I/O;
CPU-->Power;
I/O-->GPIO;
I/O-->Ethernet;
I/O-->USB;
```
## The details
Let's break this down a bit and give some more concrete examples.
**PC/Laptop**
This one’s easy: You have your CPU, RAM, disk drives, power supply, GPU, and a motherboard that ties them all together. **Every piece needs the others to function.**
**Smartphones: Computers in Your Pocket**
In a smartphone, the CPU, RAM, GPU and other (usually external) components get smooshed together in a tiny chip because space and power efficiency are everything. It’s not that they magically made volatile memory disappear - it’s just closer to the CPU for speed. Apple may claim it's revolutionary, but it's really just convenient.

**Raspberry Pi: The Transition Device**
The humble Raspberry Pi is a nice halfway point between your standard desktop and a smartphone. It’s basically a **DIY computer**, but just as capable as your everyday devices.
> [!note] Fun Fact
> The Wi-Fi chip on the Raspberry Pi is just another CPU with its own RAM! Even your network interface has its own mini-computer going on.
**TVs**
Modern TVs are just smartphones with a bigger screen and fewer apps (thankfully). Samsung didn’t get rid of CPUs or RAM - they just hid them really well.
**Cars**
Cars today (especially EVs) are essentially computers on wheels. They even have their own network! No, your car doesn’t have a Cisco switch lurking in the trunk, but it uses simpler protocols like I2C and SPI to keep things running smoothly.
> [!tip] Trivia
> Cars post-1990 usually have several computers communicating internally. It’s like a mini data center under your hood.
**Motherboards**
Even motherboards now have their own mini-computers to manage things like power-on and testing components. That BIOS update you did? It’s just code for the motherboard’s brain. Fancy motherboards may even have multiple chips doing different tasks, like managing overclocking.
> [!quote] "All computers are fundamentally the same set of components. They may move parts around, but no matter if you're troubleshooting a laptop, desktop, or even a smart fridge, **the system is still a computer.**"
> -- Probably you, explaining this to someone else.
In summary, no matter what you’re working on, remember that all computers function using these same basic parts. The details might change, and the packaging might look fancy, but fundamentally, you’re just **teaching rocks to think.**
---
# How storage works
I once spoke to a developer who was stressed about storing custom data on disk because no file format fit their exact needs. At first, it seemed silly to me, but then I realized a lot of very technical folks might not fully grasp the connection between *data* and *storage*.
So, what *is* a file, really? What makes a zip file different from a log file or an executable binary?
Let’s start with this: *What is data?*
## Bytes
A byte is the smallest unit of data a computer can handle. It’s just a series of `1`s and `0`s arranged in a particular order.
> [!abstract] A byte can store 255 distinct values. To store more, we just add more bytes.
Bytes form the foundation of how all data is stored:
```mermaid
graph TD;
Bytes -->|1s and 0s| Data_Types;
Data_Types["Data Types"] -->|Numbers, Text| Files;
Files -->|Containers| File_Formats;
File_Formats["File Formats"] -->|Magic Bytes, Headers| Programs;
```
You can think of bytes like Lego bricks - they can be combined in endless ways to represent any idea, whether it’s text, numbers, or even images. The cool thing is, **bytes are just ideas**, stored and represented in a format that computers (and programmers) agree on.
Standards like UTF-8 for text or [IEEE 754](https://standards.ieee.org/ieee/754/6210/) for floating-point numbers are ways to make sure everyone agrees on how to organize those bytes. Without these, your computer might not know what to do with the data!
## Files: A box for your bytes
So, now we know what bytes are. But what’s a *file*?
A file is a container that stores your bytes in a specific sequence. The operating system knows where the file begins and ends, and everything in between is the byte-based data that represents the file creator’s ideas.
**Streams of bytes**
Whether it’s a hard disk, flash drive, CD, or even a network, it’s all just a long stream of bytes. You can make a perfect copy of any file or storage device by copying the bytes.
When cloning storage devices, tools like `dd` perform their task by copying these bytes directly from one device to another, much like taking a snapshot of the data byte by byte.
When you insert a data CD or connect a USB drive, the OS reads bytes in key locations to figure out how the device is structured. **That’s it!** It’s just bytes!
> [!quote] "It's [bytes all the way down.](https://en.wikipedia.org/wiki/Turtles_all_the_way_down#:~:text=%22It%27s%20no%20use%2C%20Mr.%20James%E2%80%94it%27s%20turtles%20all%20the%20way%20down.%22)"
## File formats: Organizing bytes
So, what makes a zip file different from an executable or a log file? The answer is simple: it’s all about *how the developer decided to organize the bytes*.
**File Signatures and Magic Bytes**
Most file formats have something called a "signature" or "magic bytes" at the beginning. These are the first few bytes (at the very, very beginning of the file!) that identify the file type.

| **File Type** | **Magic Bytes** | **Description** |
| -------------- | ---------------- | ------------------------------------------ |
| Zip | `50 4B 03 04` | "PK" - Phillip Katz’s initials |
| ELF Executable | `7F 45 4C 46` | **E**xecutable and **L**inkable **F**ormat |
| PNG Image | `89 50 4E 47 0D` | "PNG" header identifying it as a PNG image |
| PDF Document | `25 50 44 46 2D` | "%PDF" header indicating a PDF file |
You can use the `file` command in Linux to inspect the magic bytes and find out what kind of file you’re dealing with.
```
$ file myfile.zip
myfile.zip: Zip archive data, at least v2.0 to extract
```
> [!tip] Trivia!
> The `.pdf.exe` malware trick works because file extensions are mostly meaningless to the operating system. It looks at the *first few bytes* to decide what the file is, not the extension!
## Creating a file format
Here’s where things get interesting: **You can invent your own file format**. If you’re writing a program, you can choose how the bytes are organized. As long as the program knows how to read and write the data consistently, you’re free to structure it however you want!
The same goes for transmitting data over a network. You can send and receive bytes in any order, as long as both ends agree on the structure.
For example, this could be your custom file format's structure if you so desire:
```mermaid
graph LR;
Header["File Header"] --> Data_Block_1["Data Block 1"] --> Data_Block_2["Data Block 2"];
Data_Block_2 --> Footer["End of File"];
```
**Recommended reading**: [This rant on the zip file format](https://web.archive.org/web/20240909152753/https://games.greggman.com/game/zip-rant/) because it's hilarious and gives some more insight on how these things are made.
## The big picture
All file formats - PDFs, Word documents, executables - were invented by someone who decided, "This looks like it could work," and started writing code to interpret and organize bytes that way. **That’s all there is to it.** It’s just people putting ideas into bytes and agreeing on how to read them.
In Summary:
* **Bytes**: The smallest data units, a series of `1s` and `0s`.
* **Files**: Containers that store sequences of bytes.
* **File Formats**: Structures that define how bytes are organized in a file (like a blueprint).
* **Magic Bytes**: Special sequences identifying file types, such as `PK` for zip files.
---
# How a computer boots
From here on out, we’ll be focusing on "standard" computers - PCs, servers, and laptops. While microcontrollers and ASICs are cool, they have a different set of ideas and problems that guide them.
So, you’re sitting in front of your computer - off. What really happens when you press the power button?
We’ll go step-by-step, but don’t worry, not *too* slowly.
```mermaid
graph TD;
A[Power Button] --> B[POST];
B --> C[Bootloader];
C --> D[Kernel];
D --> E[Init System];
E --> F[System Services];
F --> G[Desktop/CLI];
```
## Step 1: Power button
The power button is a [momentary switch](https://en.wikipedia.org/wiki/Push_switch) (engineering-speak for "button"). When you press it, it’s wired into the motherboard and signals the start of the boot process.
## Step 2: POST (Power-On Self-Test)
The motherboard performs a **POST**. This is a self-check where it verifies that all hardware components are compatible and error-free, like making sure the CPU is seated correctly and not about to burst into flames.
> [!note] POSTing
> When someone says "the computer is POSTing," it means the motherboard is running these self-tests. They're just looking at a screen saying something like "POST" or "checking memory". Servers can take a while to go through this.
## Step 3: Bootloader
Once the system passes POST, it searches for a **bootable device** - usually a hard drive, SSD, or even a remote device (for network boot scenarios like PXE).
**UEFI boot process**
1. The system looks for a device using **GPT format**.
2. It checks the device for a bootloader in the **EFI System Partition (ESP)**.
- This is typically located in `\EFI\BOOT\BOOTX64.EFI`.
- For Linux systems, this path is often in `/boot/efi/EFI/BOOT/BOOTX64.EFI`.
3. If it finds a bootloader, it launches it. For Linux, this is often [GRUB](https://en.wikipedia.org/wiki/GNU_GRUB), the menu that lets you select a kernel version, adjust startup parameters, etc.
**BIOS boot process**
1. The system looks for a device using **MBR format**.
2. It searches the device for a bootloader right after the **MBR magic bytes**.
3. The bootloader is then called. Again, in Linux, this is usually **GRUB**.
> [!tip] Bootloaders
> The bootloader’s sole job is to find and load the OS. Windows, macOS, or Linux - it’s all the same here.

## Step 4: Handoff to kernel
The bootloader now looks for the **Linux kernel** - usually a file starting with the name `vmlinuz`, often found in `/boot`. It can pass startup parameters to the kernel, and then hands full control of the system over to it. The bootloader is done at this point.
## Step 5: Kernel initialization
With the kernel in charge, it mounts the **root filesystem** (and only the root filesystem). From here, it:
- Initializes hardware and drivers.
- Sets up the core system environment. It’s all coming together now!
Once everything is ready, the kernel hands control over to the **init system** - either **systemd** (on most modern Linux systems) or **init/initd** (if you're stuck in the past).
> [!info] What’s next?
> From here, it’s all about system services starting up, and before you know it, you’re staring at your desktop. For more on what happens from this point, check out [Sysadmin & RHEL](Sysadmin%20&%20RHEL.md).