forewardchapter1-whylinuxchapter2-linuxmadeofchapter3-bootloaderschapter4-serverclichapter5-driveschapter6-hardwarechapter7-linuxprogramschapter8-environment

Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Foreward

This book was created to enable anyone to install and use Linux effectively. Its creation was made possible thanks to the help and support of the Chris Titus Tech community. The information contained in this book is drawn from thousands of comments, research, and real-world experiences from users who utilize Linux as their daily driver.

Special Features of This Book

Throughout this book, you will find links to videos designed to enhance the learning experience. Some concepts are better demonstrated visually than explained in text, and these resources will help you better understand the topics discussed. This book serves as a guide to accelerate your learning, allowing you to absorb knowledge efficiently without needing to watch hundreds of hours of videos.

Before you Begin

Before diving into the content, understand that Linux works very differently from Windows or macOS. It is not just a different operating system; it is a different way of thinking about how computers work. This book will help you transition to this new mindset, but it will take time to adjust. Be patient with yourself and embrace the learning process.

Also, when referring to ANY resources the date of the resource is important. This book is designed to be a living document, meaning it will be updated with new information and resources as they become available. Always check the date of the resources you are using to ensure they are still relevant and accurate. Linux moves quickly, and what was true yesterday may not be true today. This book will help you stay up-to-date with the latest information and resources available, but check the last updated date on the resources you are using to ensure they are still relevant and accurate. Each chapter will have a last updated date at the end of the chapter, and you can find the latest version of this book at https://thelinuxbook.com.

Last change: 2025-06-15

Starting Linux

Linux is a powerful and versatile operating system that gives you complete control over your computer. Whether you're looking for stability, security, or customization, Linux has something to offer for everyone. In this chapter, we'll explore the basics of Linux, including its distributions, release types, and modularity.

Why Choose Linux over Windows or MacOS?: https://links.thelinuxbook.com/whychooselinux

Distributions

Linux by itself doesn't include programs and things to make a fully function computer. So we have Linux distributions. There are many Distributions, in fact, hundreds of them that can be rather confusing. However there are three main branches that comprise the most amount of users and will be the focus of this book.

Overview of All Distributions on Linux: https://links.thelinuxbook.com/alldistros

Debian-Based Distributions

These are the majority of Linux users and most online guides are written with them in mind. They typically are very stable and long term support. When you hear Ubuntu, Linux Mint, Pop OS, Elementary OS, KDE Neon, Peppermint, and much more... they are all based around Debian. This means how you install programs and the package manger is all the same. This is typically where most users start from. Anytime you see the command apt install or .deb package the installation instructions are geared for a this distribution branch.

RHEL-Based Distributions

RedHat Enterprise Linux is what RHEL stands for. This is the backbone of many Linux servers as any RHEL based distribution is built with security and stability in mind. There are 3 distributions that most think of when it comes to the RHEL category. RedHat Enterprise Linux (Subscription-Based), CentOS (RHEL clone but no subscription), and Fedora. The package manager for these distributions is dnf install or yum install and utilizing the .rpm packages you download from sites.

Arch-Based Distributions

Arch Linux is a user created distribution that isn't backed by any company and has some unique features as a result. The main distributions you hear about in this category are Arch Linux and Manjaro. It's package manager syntax looks like pacman -S packagename and doesn't have downloadable packages like Debian or RHEL distros. It does however have a unique feature called the AUR (Arch User Repository) and is able to build programs on the fly. While this is incredibly powerful, it can also be dangerous as these aren't vetted and sometimes have old packages that are out of date. So if using the AUR always check the site to make sure it is up to date and is a legitimate source.

Distribution TypeExamplesPackage Manager SyntaxKey Features
Debian-BasedUbuntu, Linux Mint, Pop OSapt installStable, beginner-friendly
RHEL-BasedCentOS, Fedoradnf install / yum installSecure, server-focused
Arch-BasedArch Linux, Manjaropacman -SRolling release, highly customizable

Release Types

Lets go over the two types of distribution releases you will encounter Rolling and Stable. Both have their pros and cons, but depending on how you use your PC one might better than the other for you.

LTS vs Rolling Release: https://links.thelinuxbook.com/ltsvsrolling

Rolling Release

Arch Linux is what is called a rolling release, which is a version of Linux that isn't tied to a single version of the Linux kernel. By comparison, Ubuntu does 6 month releases where it will not update major system components. Arch can update the Linux kernel and other core system components every week or everyday in some instances. This is a double edged sword, as you get the latest and greatest features, but you are also prone to more bugs.

Stable LTS Release

Debian and RHEL based distributions are typically using a proven release cycle. Each distribution can have different release schedules and vary from a couple months to several years. The distributions that are specifically called LTS (Long Term Support) are made with longevity in mind. The support structure can range from 5 years (Ubuntu LTS) to 10 Years (CentOS Versions). The downside to using stable releases is the packages are sometimes considered old and are not as up to date. However, these versions will run for years and are extremely stable.

Modularity

The power of Linux is that no matter what distribution you choose, it is modular. You can modify and make massive changes to drastically change the user experience. This gives you the power to make Linux operate how ever you see fit and you are the only thing holding it back.

Linux's modularity allows you to tailor your system to your needs. Whether you're building a lightweight system for an old laptop or a high-performance gaming rig, Linux gives you the tools to make it happen. Here are some examples:

  • Server Setup: Install only essential server packages and skip the desktop environment.
  • Lightweight Desktop: Use LXDE or XFCE for older hardware.
  • Gaming System: Install Steam, Proton, and GPU drivers for a complete gaming experience.

What Distribution Should You Use

I don't consider Linux complex, but more of a rabbit hole of infinite possibilities. This is very overwhelming for a new user and often misunderstood. That is why I always recommend popular distributions with widespread support and resembling the operating system they are coming from. For Windows Users, I recommend starting with Linux Mint and for MacOS users I recommend Pop OS! as it has more Mac feel out of the box.

Tips for Choosing a Distribution

  • Windows Users: Start with Linux Mint for a familiar experience.
  • MacOS Users: Try Pop OS for a sleek and modern interface.
  • New Gaming Users: Bazzite gives an controlled environment with lots of gaming support by default. System shouldn't be
  • Advanced Gaming Users: Nobara is made by Glorius Eggroll and is a gaming focused distribution with many tweaks and optimizations for gaming out of the box. It also allows for lots of system customization.
  • Advanced Users: Explore Arch Linux or Fedora for more control and cutting-edge features.
Last change: 2025-06-17

What is a Linux Distribution Made of?

A Linux distribution comprises the same components that make up any operating system. Every Linux distribution has the following components, many of which can be customized to great effect. This is why there are so many options in Linux. With that in mind, here are the components of Linux:

Bootloader

The bootloader is what boots the machine. There are two types of boot processes for any operating system: EFI and Legacy boot. Most Linux distributions use a package called GRUB to handle this process. However, some newer distributions have started using systemd-boot instead of GRUB.

Display Renderer

For graphical elements to appear on the screen, either Xorg or Wayland is required to render the graphics. Both have their pros and cons. Xorg has been around since the beginning and is feature-rich, but its structure is messy. Wayland is newer and offers cleaner code. Personally, I use Xorg on most distributions because it does everything I need. However, most Linux distributions going forward will package Wayland by default and Xorg will eventually go away. Most servers don't need graphics and omit these packages altogether, relying only on a CLI (Command Line Interface).

Xorg vs Wayland: https://links.thelinuxbook.com/xvswayland

Display Manager

The display manager is essentially the login manager that boots into your desktop environment or window manager.

SDDM

This is the display manager for KDE. There are a lot of themes and support for both Wayland and Xorg.

GDM

This is the display manager for GNOME. Much like SDDM, lots of themes and support for both Wayland and Xorg.

LightDM

This is a more universal display manager that multiple desktop environments use because it is lightweight. Xorg Only, but is very lightweight and still widely used.

LightDM Customization: https://links.thelinuxbook.com/lightdmcustomization

None

You technically don't need a display manager, but this means you will boot into a CLI (Command Line Interface) prompt with no graphics. Alternatively, you could set a window manager or desktop environment to auto-launch without requiring a login.

Desktop Environments

Desktop environments are the bread and butter of many distributions. These are typically an assortment of programs that dictate how programs are launched, displayed, and configured. Think of these as the look and feel of Linux.

Overview of Desktop Environments: https://links.thelinuxbook.com/desktopenvironments

KDE

This is a Windows-style desktop environment with a start menu, taskbar, and basic floating window management. The workflow is very similar to Microsoft Windows. It has extensive theming capabilities, desktop widgets, and a vast array of built-in tools.

KDE Customization Video: https://links.thelinuxbook.com/kdecustomization

GNOME

GNOME has a unique workflow with window animations and extensions to expand its capabilities. It is unlike any other Desktop Environment out there but has great utility. Its strengths include robust system settings and support for scaling and tablet-style computers.

Cinnamon

This is another Windows-style desktop environment, but it is more simplistic than KDE. The menus are more intuitive, and it has everything the user needs without bundling a ton of applications. This is my first recommendation for Windows users converting to Linux.

Cinnamon Customization Video: https://links.thelinuxbook.com/cinnamoncustomization (Note: Cinnamon is made by the Linux Mint team.)

MATE

MATE is based on GNOME 2 from the past. It looks a bit dated out of the box, but its minimal design makes it lightweight and functional. It has a traditional menu system, unlike the latest version of GNOME, and can be tweaked to the user's needs without using many resources.

XFCE

Minimal, simplistic, and modular—that is XFCE's ethos, and it does a good job of it. It is one of my favorites, even though, like MATE, it is very ugly out of the box. After customization, it can look fantastic.

XFCE Customization Video: https://links.thelinuxbook.com/xfcecustomization

LXQt / LXDE

LXQt is a very minimal desktop environment with a limited feature set. It is one of the lightest desktop environments on this list and is my recommendation for those using an old PC. Using nearly no resources, it simply gets the job done. LXDE is the older version before it morphed into LXQt.

Deepin

This reminds me of macOS and is my recommendation for mac users coming to Linux who don't like GNOME. It is sleek and has a futuristic look out of the box.

Others

There are many other desktop environments that are less popular than the ones above, and I encourage you to explore them after familiarizing yourself with the ones listed.

Window Managers

Window managers are often a point of confusion for new users, as people often mix them up with desktop environments. What is the difference? Desktop environments include a suite of tools and utilities, while window managers only manage windows.

I could write another book dedicated specifically to window managers, but I'd only recommend them for advanced users who are capable of making system modifications without the assistance of utilities. For example, adjusting your display settings.

Everything is set up by the user, from adjusting volume to launching programs. Depending on the window manager, you might need to edit text files to configure them or create shortcut keys for programs. Each one is unique and not for the faint of heart. In many of my videos, I use a modified version of DWM, which can be found on my GitHub: https://github.com/ChrisTitusTech/dwm-titus

Package Manager

This is probably the biggest factor that separates distributions and also makes many of them similar. There are a variety of package managers, but I will touch on the most popular ones that most distributions are based on.

APT

Debian-based distributions (e.g., Ubuntu, Pop_OS!, Linux Mint, etc.) use APT, which is one of the oldest package managers on this list. It is also the most widely used. A good majority of Linux articles reference APT. The basic syntax is apt install package.

DNF / YUM

RHEL-based distributions (e.g., Fedora, CentOS, Nobara, etc.) use these and dominate the business space. DNF is newer and has better dependency resolution, but you will still see YUM occasionally for legacy systems or older versions. Its basic syntax is dnf install package.

Pacman

This is the oddball of the bunch, as it is used in Arch-based distributions (e.g., Manjaro, Garuda, EndeavourOS, etc.). It has non-standard syntax like pacman -S package to install a package.

Others

There are many other package managers, but these encompass most of the popular Linux installations.

Flatpak / AppImage / SnapD

These are agnostic of any distribution. This means the programs aren't install on the system-level but are self contained. Any dependencies are included with the package which makes them usable on anything Linux. Flatpak and snapd are easy to manage from the command line, but also have lots of files for each package. AppImage is contained within the singular Package.AppImage file. For managing AppImage files, I recommend using gearlever package. For managing permissions on flatpak files, I recommend the flatseal package. I do not recommend using SnapD at all as it is owned and poorly maintained by the company Canonical that distributes Ubuntu.

Misconceptions

It should be noted that most programs can be compiled to work on pretty much any Linux distribution, and all the package manager does is make it easy for you to perform the installation. There are many other ways to install a program, such as building from source. However, most times this isn't needed, as even if a package is not available in your package manager, you can expand it by adding a repository to it, thus giving your package manager access to install even more programs on the fly. Even if this fails or a repository isn't available, you can utilize universal packages like Flatpak, Snap, or AppImage that can install on any system, no matter what package manager you are using.

Types of Linux Installations

There are a variety of ways to install Linux, and I will go over them in depth. These methods are broken into three categories: Beginner, Intermediate, and Expert.

Beginner Installation

This is extremely easy to do and is where a beginner should start. The downside to a beginner install is that it has less customizability, but it is an easier starting place for a novice user.

Intermediate Installation

This method typically involves taking a base distribution from the server level and installing the needed packages as required. It yields a highly customized system with a minimal installation but requires the user to know which packages they want.

Expert Installation

Much like intermediate installation, this method advances to not using desktop environments or bundles that install multiple packages. While this method can be tedious, it results in the most minimal installation, as it avoids installing unnecessary packages. However, it requires an extreme skill level to achieve. Often, the user is building packages or even compiling the base Linux kernel.

Progression

The progression you will go through in Linux is much more than these types of installations, but I wanted to give you a path as you explore and move through these types of installations.

Build What You Want Video: https://links.thelinuxbook.com/buildanything

Last change: 2025-06-17

Bootloaders: How Linux is Loaded

There are many bootloaders available, but this chapter focuses on the two most widely used: GRUB 2 and systemd-boot.

GRUB 2 - The Most Widely Used

GRUB 2 is the most popular bootloader for Linux, offering extensive functionality. It supports themes, multiboot setups, and various other features that make it highly versatile. For Windows/Linux multiboot systems, GRUB 2 is my recommended choice.

Configuration

Before installing or updating GRUB, you need to create configuration files. One of the best resources for understanding GRUB is the https://wiki.gentoo.org/wiki/GRUB2.

Files Used for Configuration

File LocationEditableDescription
/boot/grub/grub.cfgNoGenerated by grub-mkconfig and will be overwritten. Do not edit directly.
/etc/grub.d/*YesContains scripts processed in numerical order (e.g., 10-boot, 11-os).
/etc/default/grubYesPrimary configuration file for GRUB edits. Start here for modifications.

Editing GRUB Configuration in /etc/default/grub

Below are common configuration entries in /etc/default/grub:

  • GRUB_DEFAULT: Specifies the default boot entry. Typically set to 0 for the first entry. Use 1 for the second entry, 2 for the third, and so on.
  • GRUB_TIMEOUT_STYLE: Determines whether to display a menu (MENU) or hide it (HIDDEN). If hidden, the GRUB_HIDDEN_TIMEOUT variable controls the splash screen display.
  • GRUB_TIMEOUT: Sets the menu display duration. If set to -1, the menu will never timeout and will wait for user input.
  • GRUB_CMDLINE_LINUX_DEFAULT: Adds kernel options. Common examples:
    • quiet splash: Hides verbose text output during boot.
    • nomodeset: Bypasses modesetting, useful for booting NVIDIA systems to install drivers.
    • single: Boots into single-user mode, useful for system modifications or resetting user passwords.
    • Variable declarations: Add system-specific variables, such as keymap or vfio for PCI passthrough.
  • GRUB_DISABLE_RECOVERY: Disables recovery entries. Setting this to true is recommended if recovery entries are rarely needed. You can edit GRUB directly during boot by pressing e when the menu appears.

For a complete list of GRUB configuration variables, refer to the https://links.thelinuxbook.com/grubconfig.

Sample GRUB Configuration (/etc/default/grub)

Here’s an example configuration with no menu:

GRUB_DEFAULT="0"
GRUB_TIMEOUT_STYLE="hidden"
GRUB_TIMEOUT="0"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_DISABLE_RECOVERY="true"
GRUB_DISABLE_LINUX_RECOVERY="true"

Make Configuration files

Make the configuration files with grub-mkconfig or update-grub on debian-based systems.

grub-mkconfig -o /boot/grub/grub.cfg

Manual page for grub-mkconfig: https://www.gnu.org/software/grub/manual/grub/html_node/Simple-configuration.html#Simple-configuration

OR

update-grub

Manual page for update-grub: https://manpages.debian.org/buster/grub-legacy/update-grub.8.en.html

Installation

Once your configuration files are created, you can install GRUB onto your hard disk for booting. First, determine whether the installation is EFI or Legacy BIOS.

To check if you are using EFI:

ls /sys/firmware/efi

If files are listed with the ls command you are on EFI

EFI Installation

Efi installations consist of two partitions where Legacy BIOS can have one. This makes it unique, but can also cause a multiple problems when using manual partitioning. Prior to running these commands you need to make sure the partition is mounted!

Next, we need to install EFI to this partition with this command

grub-install --efi-directory=/boot/efi

BIOS Legacy Installation

Typically in a BIOS legacy setup you have one main partition mounted to / and you run the following command to install GRUB. Note: DO NOT USE Legacy where you can use EFI!

grub-install 

You can also do a variation of this if you have multiple drives or are dual booting. Find the drive you are installing it on using the command lsblk OR blkid as these give more information about your drive setup

Example usage when specifying a drive:

grub-install /dev/sda

For the full usage of grub-install here is the manual page: https://www.gnu.org/software/grub/manual/grub/html_node/Installing-GRUB-using-grub_002dinstall.html

GRUB Videos

These are the videos I've done on GRUB via YouTube:

Systemd Boot - Minimal Built-In boot

Many distributions are now starting to ship with systemd boot instead of GRUB (PopOS! is one example) and is an interesting boot manager when you don't want a menu or extra packages to boot into your Linux.

Note: systemd boot has the capabilities of menus and dual boot, but setting this up is much more cumbersome and why I recommend using GRUB instead of doing this

Systemd-boot is also an EFI ONLY bootloader. So if you aren't booted in using UEFI, you can NOT install systemd-boot. Verify that you are in efi mode using ls /sys/firmware/efi

Systemd has a dedicated site for documentation. Check it out @ https://systemd.io/ and look at the Booting Section for systemd-boot. Another good source for systemd-boot information is the Arch Wiki @ https://wiki.archlinux.org/title/systemd-boot

Configuraiton

Here is the directory breakdown for systemd-boot

  • Main Directory: /boot/efi (Sometimes this can be /boot in rare instances and some systems it adds a EFI subdirectory, ex. /boot/efi/EFI)
  • Configuration files: /boot/efi/loader (General configuration in loader.conf)
  • OS Entries: /boot/efi/loader/entries (Each .conf is a boot entry)

General Configuration

The general configuration will be the loader.conf in the root of the /loader directory. Here is the syntax:

  • default – Default boot option and it can be a wildcard like arch-*.conf.
  • timeout – menu timeout in seconds before the default entry is booted. If this is not set, the menu will only be shown on key press during boot.
  • editor – yes is default, but this allows editing boot entries and can be used to reset password or get system level access. Set to no if security is a concern.
  • auto-entries – shows automatic entries for Windows, EFI Shell, and Default Loader if set to 1 (default), 0 to hide;
  • auto-firmware – shows entry for rebooting into UEFI firmware settings if set to 1 (default), 0 to hide;
  • console-mode – changes UEFI console mode:
    • 0 for 80x25
    • 1 for 80x50
    • 2 and above for non-standard modes provided by the device firmware
    • auto picks a suitable mode automatically
    • max for highest available mode
    • keep (default) for the firmware selected mode.

boot/efi/loader/loader.conf example

default  arch.conf
timeout  4
console-mode max
editor   no

Adding Boot Entries

Every boot entry will be loaded from the /loader/entries directory. Here is that syntax:

  • title – operating system name. Required.

  • version – kernel version. Optional.

  • machine-id – machine identifier from /etc/machine-id. Optional.

  • efi – EFI program to start. Either this parameter or linux is required.

  • options – space-separated command line options to pass to the EFI program or kernel parameters. root="UUID=3255683f-53a2-4fdf-91cf" OR root="LABEL=OS Label" is required for booting Linux. Here are common options:

    • rw = Read-Write needed for most installs
    • root = UUID or Label used for identifying the root partition
    • silent = do NOT display any console output
    • splash = display OS Splash screen
    • nomodeset = disable Kernel mode setting. Often needed if using NVIDIA cards and you do not have the drivers installed.
    • S = run in single mode (often required for resetting root password or modifying root file system)

    Q: How do you find the UUID? A: The command sudo blkid

    _Note: To identify specific drive labels I recommend sudo lsblk which gives a readout of all drives and where they are mounted. When used in conjunction with blkid you will be able to tell what each drive is.

Check all kernel parameters @ https://links.thelinuxbook.com/kernelparameters

Example Arch Linux Entry /boot/efi/loader/entries/arch.conf

title   Arch Linux
linux   /vmlinuz-linux
initrd  /intel-ucode.img
initrd  /initramfs-linux.img
options root="LABEL=arch" rw

Example Windows 10 Entry /boot/efi/loader/entries/win10.conf

title Windows 10
efi /EFI/Microsoft/Boot/bootmgfw.efi

Automatic EFI Entry creation with the efibootmgr package - You can check to see what efi options are installed to you with efibootmgr -v.

efibootmgr --create --disk /dev/sda --part 1 --loader "\EFI\systemd\systemd-bootx64.efi" --label "Linux OS" --verbose

Note: This command is used if your Linux EFI system partition is located @ /dev/sda1 and the EFI file located @ /boot/efi/EFI/systemd/systemd-bootx64.efi

Installation

The default install is very easy once configuration is done. You simply type bootctl install and you are done!

There are configurations with multiple boot partitions, but I do not recommend using systemd-boot for this.

In most instances this will auto update when boot options change, but you can force an update if you manually add more entries with bootctl update

Last change: 2025-06-17

Server Command Line Interface: Mastering the Terminal

This chapter covers the most important aspect of Linux: the terminal. The terminal is the beating heart of Linux, enabling you to accomplish virtually anything. For the first eight years I used Linux, I relied exclusively on the terminal, never even considering a graphical interface. The terminal is reliable, quick, and efficient, making it an indispensable tool for Linux users.

Pro Tip: The terminal is always accessible. If you're stuck on a black screen or graphical interface, press Ctrl + Alt + F2 or Ctrl + Alt + F3 to switch to a terminal. To return to the graphical interface, press Ctrl + Alt + F7.


Videos: How to Make Bash Terminal look and feel GREAT! https://links.thelinuxbook.com/prettybash

Types of Terminals

  • TTY: A terminal connected to a physical device, such as a keyboard and monitor
  • GUI Terminal: A terminal emulator that provides a graphical interface for command-line operations, such as GNOME Terminal, Konsole, or xterm

TTY is used for direct interaction with the system, while GUI terminals provide a more user-friendly experience with features like tabs, copy-paste, and customizable appearance. TTY is often used for system recovery or when the graphical interface is unavailable or malfunctioning.

To access a TTY terminal, you can use the following key combinations:

  • Ctrl + Alt + F1 to Ctrl + Alt + F6: Switch to different TTY terminals (TTY1 to TTY6)
  • Ctrl + Alt + F7: Return to the graphical interface (usually TTY7)

GUI Terminals are typically launched from the applications menu or by pressing Ctrl + Alt + T in most desktop environments or hotkey like Super + Enter in many Tiled Window Managers (TWM).

  • GNOME Terminal: Default terminal for GNOME desktop environments, supports tabs and profiles
  • Konsole: Default terminal for KDE Plasma, highly customizable with split views and profiles
  • Alacritty: A fast, GPU-accelerated terminal emulator with a focus on performance and simplicity
  • Kitty: A feature-rich terminal emulator with support for graphics
  • Terminator: Allows multiple terminal windows in a single window, with customizable layouts

Directory Movement Commands and Examples:

  • cd (change directory):
    • cd .. (move up a directory)
    • cd name (move into the specified directory)
    • cd / (move to the root directory)
    • cd ~ (move to the home directory, e.g., /home/titus)
    • zoxide - A better package for navigating the file system, using fuzzy finding and remembering past directories. _Note: zoxide is a third-party tool that can be installed via your package manager. Watch the video I did on Zoxide: https://links.thelinuxbook.com/zoxide
  • ls (list files):
    • ls -a (show all files, including hidden ones)
    • ls -l (long listing format showing permissions)
  • rm (remove files):
    • rm -rf (remove files/directories recursively and forcefully)
    • rmdir (remove empty directories)
    • trash-cli - An alternative to rm that moves files to the trash instead of permanently deleting them.
  • cp (copy files):
    • cp -r (copy files and subdirectories recursively)
    • rsync - A more efficient tool for copying or syncing large amounts of files.
  • mv (move files):
    • mv file1.txt file2.txt (rename or move files)
    • mv /path/to/file /new/path/ (move a file to a new location)
  • pwd (print working directory):
    • Displays the current directory path.
  • find (search for files):
    • find /path/to/search -name "filename" (search for a file by name)
    • find /path/to/search -type d -name "dirname" (search for a directory by name)
    • fd - A faster alternative to find with a simpler syntax.
  • locate (find files by name):
    • locate filename (find files by name using a pre-built index)
    • updatedb (update the locate database, usually run automatically by the system)
  • tree (display directory structure):
    • tree (display the directory structure in a tree-like format)
    • tree -L 2 (limit the depth of the tree display to 2 levels)
  • ln (create links):
    • ln -s /path/to/original /path/to/link (create a symbolic link)
    • ln /path/to/original /path/to/link (create a hard link)
  • chmod (change file permissions):
    • chmod 755 file (set permissions to read, write, and execute for owner, and read and execute for group and others)
    • chmod +x script.sh (make a script executable)
  • chown (change file ownership):
    • chown user:group file (change ownership of a file to a specific user and group)
    • chown -R user:group /path/to/directory (change ownership recursively for a directory)
  • stat (display file or filesystem status):
    • stat file (show detailed information about a file, including size, permissions, and timestamps)
    • stat /path/to/directory (show information about a directory)
  • du (disk usage):
    • du -h (display disk usage in human-readable format)
    • du -sh /path/to/directory (show total size of a directory)
  • df (disk space usage):
    • df -h (display disk space usage in human-readable format)
    • df -i (show inode usage instead of disk space)

Directory Layout and File System Overview

  • / - Root directory
  • /bin - System executable files
  • /boot - Bootloader files
  • /dev - Device files (requires mounting to browse)
  • /etc - System configuration files
  • /home - User files and configuration files
  • /media - Mounted external media
  • /mnt - Temporary mount points
  • /opt - Optional files
  • /root - Root user files and configurations
  • /tmp - Temporary files
  • /usr - System resources
  • /var - Logs, databases, and other variable data

Most interactions with the file system occur within the /home/user directory. This includes configuration files and executable programs. Direct editing of system-wide configuration files in /etc or adding programs to /bin should be done sparingly.


System Services and Configuration

Modern Linux distributions use an "init system" to control system operations, primarily systemd. Systemd manages services, boot processes, networking, and more.


Controlling Services and Units

systemctl is the primary tool for managing services and units in systemd. Units can represent services, device drivers, network mounts, timers (similar to crontab), and more.

Common systemctl Commands:

  • systemctl status servicename - View the current status of a service.
  • systemctl start servicename - Start a service.
  • systemctl stop servicename - Stop a service.
  • systemctl restart servicename - Restart a service (stop and start).
  • systemctl reload servicename - Reload the configuration file without restarting the service.
  • systemctl enable servicename - Enable a service to start at system boot.
  • systemctl is-enabled servicename - Check if a service is enabled at startup.
  • systemctl is-active servicename - Check if a service is running and active.
  • systemctl list-units - List all running systemd units.
  • systemctl list-units --all - List all units, both active and inactive.
  • systemctl list-units --all --state=inactive - List all inactive units.
  • systemctl list-units --all --type=service - List all units of type "service."

Unit File Locations

Systemd unit files are typically located in the following directories:

  • /usr/lib/systemd - The main location for system-created unit files.
  • /etc/systemd/system - Contains system-wide unit files, often symbolic links to /usr/lib/systemd. This directory has top priority when reading unit files.
  • ~/.config/systemd/user/ - Contains user-specific unit files. This directory is not created by default and requires the --user option for systemctl commands.

Example System Unit File

Below is an example of a system unit file:

[Unit]
Description=service_description
After=network.target

[Service]
ExecStart=path_to_executable
Type=forking

[Install]
WantedBy=default.target

For a full reference, Systemd Unit Documentation https://links.thelinuxbook.com/systemd.


User-Based Systemd Services and Unit Files

User-specific unit files are stored in the ~/.config/systemd/user/ directory. These files can be managed using the --user option with systemctl.

Example Command:

systemctl --user start usercreatedfile.service

This command starts a user-created service file located in the user's home directory.

Example User Unit File:

[Unit]
Description=Run service as user
DefaultDependencies=no
After=network.target

[Service]
Type=simple
User=titus
Group=users
ExecStart=/home/titus/scripts/startup_script.sh
TimeoutStartSec=0
RemainAfterExit=yes

[Install]
WantedBy=default.target

Bluetooth Configuration

To configure Bluetooth, you can use the bluetoothctl command-line tool. This tool allows you to manage Bluetooth devices and settings directly from the terminal.

Syntax for bluetoothctl commands:

bluetoothctl [command]

Common bluetoothctl Commands:

  • power on - Turn on the Bluetooth adapter.
  • power off - Turn off the Bluetooth adapter.
  • agent on - Enable the agent for pairing.
  • scan on - Start scanning for nearby Bluetooth devices.
  • scan off - Stop scanning for Bluetooth devices.
  • pair <device_address> - Pair with a specific Bluetooth device.
  • connect <device_address> - Connect to a paired Bluetooth device.
  • disconnect <device_address> - Disconnect from a connected Bluetooth device.
  • devices - List all known Bluetooth devices.
  • info <device_address> - Show detailed information about a specific Bluetooth device.

Example Usage:

bluetoothctl
power on
agent on
scan on

This will turn on the Bluetooth adapter, enable the agent for pairing, and start scanning for nearby Bluetooth devices.

Note: blueman is a graphical Bluetooth manager that can be used as an alternative to bluetoothctl for those who prefer a GUI.

Audio Configuration

Linux provides several command-line tools for managing audio. The two main sound systems are ALSA (Advanced Linux Sound Architecture) and PulseAudio, with PulseAudio running on top of ALSA.

PulseAudio Commands (pactl)

The pactl command is used to control the PulseAudio sound server:

# List audio sources and sinks
pactl list sources        # List input devices
pactl list sinks         # List output devices

# Volume control
pactl set-sink-volume @DEFAULT_SINK@ 50%     # Set volume to 50%
pactl set-sink-mute @DEFAULT_SINK@ toggle    # Toggle mute

# List loaded modules
pactl list modules

ALSA Mixer (alsamixer)

alsamixer is a terminal-based mixer program for ALSA:

alsamixer    # Open the mixer interface

Navigation in alsamixer:

  • Arrow keys: Navigate between channels
  • Up/Down: Adjust volume
  • M: Toggle mute
  • F6: Select sound card
  • Esc: Exit

Common Audio Troubleshooting Commands

# Restart PulseAudio
pulseaudio -k        # Kill the PulseAudio daemon
pulseaudio --start   # Start PulseAudio

# Check audio devices
aplay -l             # List all ALSA playback devices
arecord -l          # List all ALSA recording devices

# Test audio output
speaker-test -c 2    # Test stereo speakers

Audio Device Management with pavucontrol

While pavucontrol is technically a GUI application, it can be installed and launched from the terminal:

sudo apt install pavucontrol   # Install on Debian/Ubuntu
pavucontrol                    # Launch the control interface

Pipewire Audio System

Pipewire is the modern replacement for both PulseAudio and JACK. It maintains compatibility with PulseAudio clients, so pactl commands work with Pipewire. Additionally, Pipewire provides its own tools:

# Check Pipewire status
pw-cli status
pw-top                # Show real-time audio processing graph

# List audio devices
pw-dump               # Detailed info about audio devices and nodes
pw-cli list-objects   # List all Pipewire objects

# Control specific nodes
pw-cli node-id        # Get ID of audio nodes
pw-metadata -n settings 0 clock.force-rate 48000  # Set sample rate

# Monitor audio
pw-mon               # Monitor Pipewire events in real-time

You can still use PulseAudio tools with Pipewire:

  • pactl commands work as shown above
  • pavucontrol works normally
  • ALSA applications work without modification

Note: Most modern Linux distributions are transitioning to Pipewire as their default audio system due to its improved latency, Bluetooth handling, and compatibility with both PulseAudio and JACK applications.

Typical Pipewire Package Names:
  • pipewire - Core Pipewire package
  • pipewire-pulse - PulseAudio compatibility layer
  • pipewire-jack - JACK compatibility layer
  • pipewire-alsa - ALSA compatibility layer
  • wireplumber - Session manager for Pipewire

Note: Do NOT use pipewire-media-session, as it is deprecated and replaced by wireplumber.

Remote Access and SSH

Remote access is a crucial aspect of server management. The most common method for remote access in Linux is through SSH (Secure Shell). SSH allows you to securely connect to a remote machine and execute commands as if you were physically present.

Setting Up SSH

To set up SSH on your Linux server, follow these steps:

  1. Install OpenSSH Server:

    sudo apt install openssh-server  # Debian/Ubuntu
    sudo dnf install openssh-server  # Fedora/RHEL
    sudo pacman -S openssh            # Arch Linux
    
  2. Start and Enable the SSH Service:

    sudo systemctl start sshd         # Start the SSH service
    sudo systemctl enable sshd        # Enable SSH to start on boot
    
  3. Check SSH Status:

    sudo systemctl status sshd        # Check the status of the SSH service
    
  4. Configure SSH: Edit the SSH configuration file located at /etc/ssh/sshd_config to customize settings such as port number, allowed users, and authentication methods.

    sudo nano /etc/ssh/sshd_config
    

    Common configurations include:

    • Port 22 (change to a different port for security)
    • PermitRootLogin no (disable root login for security)
    • PasswordAuthentication yes/no (enable or disable password authentication)
  5. Restart SSH Service:

    sudo systemctl restart sshd       # Restart the SSH service to apply changes
    

    For more advanced SSH configurations, you can set up key-based authentication, which is more secure than password-based authentication. To do this, generate an SSH key pair on your local machine and copy the public key to the server:

ssh-keygen

This command generates a public/private key pair. You can then copy the public key to the server using: Note: id_rsa.pub is the default public key file generated by ssh-keygen with default options.

ssh-copy-id user@server_ip -i ~/.ssh/id_rsa.pub

This command copies your public key to the server's ~/.ssh/authorized_keys file, allowing you to log in without a password.

Connecting to a Remote Server

To connect to a remote server using SSH, use the following command:

ssh user@server_ip

Replace user with your username on the remote server and server_ip with the server's IP address or hostname. If you changed the SSH port, use the -p option:

ssh -p port_number user@server_ip

Common SSH Options

  • -i /path/to/private_key: Specify a private key file for authentication.
  • -X: Enable X11 forwarding to run graphical applications over SSH.
  • -C: Enable compression for faster transfers.
  • -v: Enable verbose mode for debugging connection issues.

SSH Configuration File

You can create a configuration file at ~/.ssh/config to simplify SSH connections. Here’s an example configuration:

Host myserver
    HostName server_ip
    User user
    Port 22
    IdentityFile ~/.ssh/id_rsa

This allows you to connect to the server using:

ssh myserver

Remote File Transfer with SCP and SFTP

To transfer files between your local machine and a remote server, you can use scp (Secure Copy Protocol) or sftp (SSH File Transfer Protocol).

Using SCP

To copy a file from your local machine to a remote server:

scp /path/to/local/file user@server_ip:/path/to/remote/directory

To copy a file from a remote server to your local machine:

scp user@server_ip:/path/to/remote/file /path/to/local/directory
Using SFTP

To start an SFTP session with a remote server:

sftp user@server_ip

Once connected, you can use commands like get, put, ls, and cd to navigate and transfer files:

get remote_file.txt          # Download a file from the server
put local_file.txt           # Upload a file to the server
ls                            # List files in the current directory
cd /path/to/directory        # Change directory on the server

Remote Desktop Access

For graphical remote access, you can use tools like VNC (Virtual Network Computing) or RDP (Remote Desktop Protocol). These tools allow you to access the graphical desktop environment of a remote server.

VNC allows you to remotely control a graphical desktop environment. To set up a VNC server, you can use TigerVNC or x11vnc.

Debian/Ubuntu
sudo apt update
sudo apt install tigervnc-standalone-server tigervnc-common
Fedora
sudo dnf install tigervnc-server tigervnc-server-module
Arch Linux
sudo pacman -S tigervnc
Configuration
1. Set VNC Password
vncpasswd
2. Create VNC Service Configuration
For Debian/Ubuntu and Arch:

Create a systemd service file:

sudo nano /etc/systemd/system/[email protected]

Add the following content:

[Unit]
Description=Start TigerVNC server at startup
After=syslog.target network.target

[Service]
Type=forking
User=your-username
Group=your-username
WorkingDirectory=/home/your-username

PIDFile=/home/your-username/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1024x768 -localhost :%i
ExecStop=/usr/bin/vncserver -kill :%i

[Install]
WantedBy=multi-user.target
For Fedora:

Copy the example service file:

sudo cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:1.service

Edit the service file:

sudo nano /etc/systemd/system/vncserver@:1.service

Replace <USER> with your username in the file.

3. Configure VNC Startup Script

Create or edit the VNC startup script:

nano ~/.vnc/xstartup

Add the following content:

#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &

Make it executable:

chmod +x ~/.vnc/xstartup
Starting VNC Server
Manual Start
vncserver :1 -geometry 1024x768 -depth 24 -localhost
# Enable and start the service
sudo systemctl enable vncserver@:1.service
sudo systemctl start vncserver@:1.service

# Check status
sudo systemctl status vncserver@:1.service
Connecting to VNC
Local Connection
vncviewer localhost:5901
ssh -L 5901:localhost:5901 username@remote-server
# Then connect to localhost:5901
Security Considerations
  1. Always use SSH tunneling for remote connections
  2. Bind to localhost only using the -localhost option
  3. Use strong passwords with vncpasswd
  4. Consider using x11vnc for sharing existing X sessions instead of creating new ones
Troubleshooting
Check VNC server status
vncserver -list
Kill VNC session
vncserver -kill :1
View VNC logs
tail -f ~/.vnc/*.log
Common Issues
  1. Display not starting: Check ~/.vnc/xstartup permissions and desktop environment availability
  2. Connection refused: Verify firewall settings and that VNC is listening on the correct port
  3. Black screen: Ensure your desktop environment is properly configured in the startup script
Alternative: x11vnc for Existing Sessions

If you want to share your current desktop session instead of creating a new one:

Installation
# Debian/Ubuntu
sudo apt install x11vnc

# Fedora
sudo dnf install x11vnc

# Arch
sudo pacman -S x11vnc
Usage
x11vnc -display :0 -auth ~/.Xauthority -localhost -rfbauth ~/.vnc/passwd

LAMP Stack (Linux, Apache, MySQL, PHP) Website Setup

The LAMP stack is a popular web server configuration that includes Linux, Apache, MySQL (or MariaDB), and PHP. This stack is widely used for hosting dynamic websites and web applications.

Installing the LAMP Stack

Debian/Ubuntu
# Update package index
sudo apt update

# Install Apache
sudo apt install apache2

# Install MariaDB (MySQL alternative)
sudo apt install mariadb-server

# Install PHP and common modules
sudo apt install php libapache2-mod-php php-mysql php-cli php-curl php-gd php-mbstring php-xml php-zip

# Enable Apache modules
sudo a2enmod rewrite
sudo systemctl restart apache2

# Secure MariaDB installation
sudo mysql_secure_installation

# Start and enable services
sudo systemctl enable apache2
sudo systemctl enable mariadb
sudo systemctl start apache2
sudo systemctl start mariadb
Fedora/RHEL
# Update system
sudo dnf update

# Install Apache
sudo dnf install httpd

# Install MariaDB
sudo dnf install mariadb-server

# Install PHP and modules
sudo dnf install php php-mysqlnd php-cli php-curl php-gd php-mbstring php-xml php-zip

# Start and enable services
sudo systemctl enable httpd
sudo systemctl enable mariadb
sudo systemctl start httpd
sudo systemctl start mariadb

# Secure MariaDB installation
sudo mysql_secure_installation

# Configure firewall
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
Arch Linux
# Update system
sudo pacman -Syu

# Install Apache
sudo pacman -S apache

# Install MariaDB
sudo pacman -S mariadb

# Install PHP and modules
sudo pacman -S php php-apache php-mysql php-gd php-curl

# Initialize MariaDB
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

# Configure PHP with Apache
sudo nano /etc/httpd/conf/httpd.conf
# Add these lines:
# LoadModule php_module modules/libphp.so
# AddHandler php-script .php
# Include conf/extra/php_module.conf

# Start and enable services
sudo systemctl enable httpd
sudo systemctl enable mariadb
sudo systemctl start httpd
sudo systemctl start mariadb

# Secure MariaDB installation
sudo mysql_secure_installation

Testing the LAMP Stack

Test PHP installation

echo "" | sudo tee /var/www/html/info.php

Create a test database (optional)
sudo mysql -u root -p
# CREATE DATABASE testdb;
# CREATE USER 'testuser'@'localhost' IDENTIFIED BY 'password';
# GRANT ALL PRIVILEGES ON testdb.* TO 'testuser'@'localhost';
# FLUSH PRIVILEGES;
# EXIT;

Set proper permissions

# Set ownership of the web directory
sudo chown -R www-data:www-data /var/www/html  # Debian/Ubuntu
sudo chown -R apache:apache /var/www/html      # Fedora/Arch
Access the test page

Open a web browser and navigate to http://your_server_ip/info.php. You should see the PHP information page, confirming that PHP is working correctly with Apache.

Remove the test page
sudo rm /var/www/html/info.php
Enable HTTPS in Apache

To enable HTTPS, you need to install an SSL certificate. You can use Let's Encrypt for free SSL certificates.

Install Certbot
# Debian/Ubuntu
sudo apt install certbot python3-certbot-apache
# Fedora/RHEL
sudo dnf install certbot python3-certbot-apache
# Arch Linux
sudo pacman -S certbot certbot-apache
Obtain and Install SSL Certificate
sudo certbot --apache -d your_domain.com -d www.your_domain.com

This command will automatically configure Apache to use the SSL certificate. Follow the prompts to complete the installation.

Verify SSL Configuration

After obtaining the SSL certificate, you can verify the configuration by accessing your website using https://your_domain.com. You should see a secure connection with a padlock icon in the browser's address bar.

Renew SSL Certificate

Let's Encrypt certificates are valid for 90 days. To renew the certificate automatically, you can set up a cron job or use the systemd timer.

# Test renewal process
sudo certbot renew --dry-run
Set up a cron job for automatic renewal
# Open the crontab editor
crontab -e
# Add the following line to run the renewal command daily
0 0 * * * /usr/bin/certbot renew --quiet

Finding IP Address and Hostname

To find your server's IP address and hostname, you can use the following commands:

# Find IP address
curl ifconfig.me  # Get the public IP address
curl ipinfo.io/ip  # Another way to get the public IP address
ip addr show  # Show all network interfaces and their IP addresses
ip a  # Shorter version of the above command
ip route get 1  # Get the default route and associated IP address
# Find private IP address
hostname -I  # Get the private IP address(es) of the server

Find hostname

hostname  # Get the hostname
hostname -f  # Get the fully qualified domain name (FQDN)
Last change: 2025-06-24

Drives and Filesystems

This chapter focuses on managing drives and filesystems in Linux, including mounting and unmounting drives, understanding filesystems, and using tools like fdisk, mkfs, and fsck.

Understanding Drives and Filesystems

In Linux, drives and filesystems are fundamental components that allow the operating system to store and retrieve data. Each drive can have one or more partitions, and each partition can be formatted with a specific filesystem type.

Common Filesystem Types

  • ext4: The most common filesystem for Linux, known for its performance and reliability.
  • xfs: A high-performance filesystem often used for large files and high-capacity storage.
  • btrfs: A modern filesystem with advanced features like snapshots and dynamic resizing.
  • vfat: A filesystem compatible with Windows, often used for USB drives, external storage, and EFI boot partitions.
  • ntfs: The Windows NT filesystem, used for compatibility with Windows systems.
  • swap: A special filesystem used for swap space, which is used when the system runs out of RAM.

Personally, I use ext4 for most of my drives, xfs for large data storage, and vfat for USB drives and EFI partitions. I avoid btrfs due to its complexity and potential issues with data integrity, although it has improved significantly in recent years. If you are interested in using btrfs check out this article and video I wrote about it: https://christitus.com/btrfs-guide/. The biggest advantage of btrfs is its ability to take snapshots, which can be useful for backups and system recovery. However, it requires more advanced knowledge to manage effectively.

Drive Management Tools

  • fdisk: A command-line utility for managing disk partitions. It allows you to create, delete, and modify partitions on a disk.
  • parted: A more advanced command-line utility for managing disk partitions, supporting larger disks and more complex partitioning schemes.
  • lsblk: A command-line utility that lists block devices, including drives and partitions, along with their mount points and filesystem types.
  • blkid: A command-line utility that displays information about block devices, including their UUIDs and filesystem types.
  • df: A command-line utility that displays disk space usage for mounted filesystems.
  • du: A command-line utility that estimates file and directory space usage.
  • mount: A command-line utility that mounts filesystems to specific directories, allowing access to the data stored on those filesystems.
  • umount: A command-line utility that unmounts filesystems, making them inaccessible until remounted.
  • mkfs: A command-line utility that creates a filesystem on a partition or disk.
  • fsck: A command-line utility that checks and repairs filesystems for errors.
  • lsusb: A command-line utility that lists USB devices connected to the system, useful for identifying external drives and other USB peripherals.
  • lspci: A command-line utility that lists PCI devices, including internal drives and controllers.
  • smartctl: A command-line utility that monitors the health of hard drives and SSDs using S.M.A.R.T. (Self-Monitoring, Analysis, and Reporting Technology) data.
  • hdparm: A command-line utility that allows you to configure and manage hard drives, including setting power management options and testing drive performance.
  • gparted: A graphical partition editor that allows you to create, delete, and modify partitions on a disk using a user-friendly interface.

Mounting and Unmounting Drives

Mounting and unmounting drives is a common task in Linux, especially when dealing with external storage devices or network shares.

Mount commands:

# Mount a filesystem
sudo mount /dev/sdX1 /mnt/mydrive
# Unmount a filesystem
sudo umount /mnt/mydrive

Mounting Drives

To mount a drive, you need to specify the device (e.g., /dev/sda1) and the mount point (e.g., /mnt/mydrive). The mount point is a directory where the contents of the drive will be accessible. You can also specify the filesystem type and mount options if needed. For example, to mount an ext4 filesystem with read-write permissions, you can use:

sudo mount -t ext4 -o rw /dev/sdX1 /mnt/mydrive

Where -t specifies the filesystem type and -o specifies mount options.

Unmounting Drives

To unmount a drive, you can use the umount command followed by the mount point or device name. For example:

sudo umount /mnt/mydrive

If the drive is busy or in use, you may need to close any open files or processes using it before unmounting. You can also use the -l option to perform a lazy unmount, which detaches the filesystem but allows it to be cleaned up later:

sudo umount -l /mnt/mydrive

Filesystem Management

Managing filesystems in Linux involves creating, formatting, and checking filesystems on drives and partitions. This section covers the essential commands and tools for filesystem management.

Creating Filesystems

WARNING: Creating a filesystem will erase and format all data on the partition. Ensure you have backups of any important data before proceeding.

To create a filesystem on a partition, you can use the mkfs command followed by the filesystem type and the device name. For example, to create an ext4 filesystem on /dev/sdX1, you can use:

sudo mkfs.ext4 /dev/sdX1

You can also specify other filesystem types, such as mkfs.xfs for XFS or mkfs.fat -F 32 for FAT32. For example:

sudo mkfs.xfs /dev/sdX1
sudo mkfs.fat -F 32 /dev/sdX1

Note: When dealing with EFI System Partitions (ESP), I recommend referring to the this docuumentation: https://wiki.archlinux.org/title/EFI_system_partition for the most up-to-date information on creating and managing ESPs.

Checking Filesystems

To check a filesystem for errors, you can use the fsck command followed by the device name. For example, to check an ext4 filesystem on /dev/sdX1, you can use:

sudo fsck.ext4 /dev/sdX1

If you want to automatically fix errors, you can use the -y option:

sudo fsck.ext4 -y /dev/sdX1

Viewing Filesystem Information

To view information about filesystems, you can use the df command, which displays disk space usage for mounted filesystems. For example:

df -h

This command shows the disk space usage in a human-readable format, including the total size, used space, available space, and mount points for each filesystem.

Fstab Configuration

The /etc/fstab file is used to define how disk partitions, network shares, and other file systems are mounted at boot time. Each line in the file represents a file system and its mount options.

Fstab structure:

  • Device: usually the given name or UUID of the mounted device (sda1/sda2/etc).
  • Mount Point: designates the directory where the device is/will be mounted.
  • File System Type: nothing trick here, shows the type of filesystem in use. Options: lists any active mount options. If using multiple options they must be separated by commas.
  • Backup Operation: (the first digit) this is a binary system where 1 = dump utility backup of a partition. 0 = no backup. This is an outdated backup method and should NOT be used.
  • File System Check Order: (second digit) Here we can see three possible outcomes. 0 means that fsck will not check the filesystem. Numbers higher than this represent the check order. The root filesystem should be set to 1 and other partitions set to 2.

Stntax:

# <device> <mount point> <file system type> <options> <backup operation> <fsck order>

Example:

UUID=1234-5678 /mnt/data  ext4 defaults 0 2
/dev/sdb1      /media/usb vfat defaults,nofail 0 0

Options:

  • defaults: Use default mount options.
  • nofail: Ignore errors when mounting the filesystem.
  • noauto: Do not mount automatically at boot.
  • user: Allow non-root users to mount the filesystem.
  • rw: Mount the filesystem as read-write.
  • ro: Mount the filesystem as read-only.
  • exec: Allow execution of binaries on the filesystem.
  • noexec: Prevent execution of binaries on the filesystem.
  • sync: All I/O operations are done synchronously.
  • async: All I/O operations are done asynchronously.
  • uid=1000: Set the owner of the mounted filesystem to user ID 1000.
  • gid=1000: Set the group of the mounted filesystem to group ID 1000.
  • umask=022: Set the default permissions for files and directories on the mounted filesystem.
  • dmask=027: Set the default permissions for directories on the mounted filesystem.
  • fmask=133: Set the default permissions for files on the mounted filesystem.

My fstab file with NFS mounts and multiple drives:

# Static information about the filesystems.
# See fstab(5) for details.

# <file system> <dir> <type> <options> <dump> <pass>
# /dev/nvme1n1p2
UUID=1188f001-7a26-4d75-819f-202e4ef2da96	/         	ext4      	rw,relatime	0 1

# /dev/nvme1n1p1
UUID=3337-A669      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2

# /dev/nvme1n1p3
UUID=df8df26b-3bdc-427d-be86-43d6a25208b4	/home     	ext4      	rw,relatime	0 2

# Network Drives
10.0.0.2:/volume2/Images		/media/images	nfs	x-systemd.after=network-online.target,x-systemd.automount,x-systemd.mount-timeout=90,_netdev 0 0
Last change: 2025-06-16

Linux Hardware Compatibility

The biggest myth told by the Linux community is that Linux works on all hardware. This is not true, and it is a common misconception that leads to many users being disappointed when they try to install Linux on their machines. The reality is that while Linux supports a wide range of hardware, there are still many devices that do not work well or at all with Linux.

Incompatible Hardware

Some hardware is simply not compatible with Linux. This can be due to a lack of drivers, proprietary firmware, or other issues. For example, some Wi-Fi adapters, graphics cards, and printers may not work properly on Linux. Before installing Linux, it is essential to check the compatibility of your hardware.

Hardware I've personally had issues with includes:

  • NVIDIA Graphics Cards: While NVIDIA provides proprietary drivers for Linux, they can be difficult to install and may not work with all distributions. Open-source alternatives like Nouveau exist but often lack performance and features. This is getting better with each kernel release, and nVidia open sourcing their drives, but still is a common issue. I've had issues with obscure Wayland configurations, Custom Linux Kernels, and certain desktop environments that do not play well with NVIDIA drivers. AMD graphics is still the best option for Linux users by a large margin. Keep an eye on the official NVIDIA open source drivers with the package nvidia-open for your distribution, as they are improving over time. Arch Linux users will be the first to see these improvements, as they are the first to implement new features. Debian and Ubuntu users typically see these improvements about 6 months later, and Fedora users about 3 months later. However, LTS releases will take longer to update.
  • Broadcom Wi-Fi Adapters: Many Broadcom Wi-Fi adapters require proprietary drivers that are not included in the Linux kernel by default. This can lead to connectivity issues.
  • Certain Printers: Some printers, especially those from manufacturers like HP and Canon, may not have Linux drivers available or may require additional configuration to work correctly.
  • Fingerprint Readers: Many fingerprint readers do not have Linux support, making them unusable for authentication purposes.
  • Webcams: Some webcams, particularly older models, may not be recognized by Linux or may require additional drivers to function correctly.
  • Bluetooth Adapters: Some Bluetooth adapters may not work out of the box and require additional drivers or configuration.
  • Touchpads: Some touchpads, especially those with advanced features, may not work correctly without additional configuration or drivers.
  • Audio Devices: Some audio devices, particularly those with proprietary drivers, may not work correctly on Linux.
  • Gaming Peripherals: Many gaming mice and keyboards may not have full functionality on Linux, especially those with customizable features.
  • Virtual Reality Headsets: Many VR headsets do not have Linux support, making them unusable for gaming or other applications.

Checking Compatibility

Before installing Linux, it is crucial to check the compatibility of your hardware. Here are some resources to help you determine if your hardware is compatible with Linux:

  • Linux Hardware Compatibility Lists: Websites like Linux Hardware provide lists of hardware that is known to work well with Linux.
  • Distribution-Specific Compatibility Lists: Many Linux distributions maintain their own hardware compatibility lists. For example, Ubuntu's Hardware Compatibility page provides information on supported devices.
  • Forums and Communities: Online forums and communities, such as the LinuxQuestions.org or the Linux 4 Noobs Subreddit, can be valuable resources for checking hardware compatibility. Users often share their experiences with specific hardware and Linux distributions.
  • Manufacturer Websites: Some hardware manufacturers provide information on Linux compatibility for their products. Check the manufacturer's website for any available drivers or support documentation.
  • Distro-Specific Tools: Some Linux distributions come with tools that can help you check hardware compatibility. lshw (List Hardware) is a command-line utility that provides detailed information about your system's hardware. You can use it to check if your hardware is recognized by the Linux kernel.
  • Live USB Testing: Before installing Linux, you can create a live USB of the distribution you want to try. Booting from the live USB allows you to test hardware compatibility without making any changes to your system. This is a great way to see if your hardware works well with Linux before committing to an installation.

Conclusion

While Linux supports a wide range of hardware, it is essential to be aware of potential compatibility issues. Before installing Linux, check the compatibility of your hardware using the resources mentioned above. By doing so, you can avoid disappointment and ensure a smooth installation and usage experience with Linux.

Last change: 2025-06-18

Linux Programs

Many windows and macOS users try to use all their favorite programs on Linux, but this is not always possible. Some programs are not available for Linux, while others may have limited functionality or require additional configuration to work correctly. This section covers some common Linux programs and alternatives to popular Windows and macOS applications.

Common Linux Programs

Linux has a wide range of programs available for various tasks, including productivity, multimedia, development, and more. For an exhaustive list of programs built and maintained by the Linux community: https://github.com/luong-komorebi/Awesome-Linux-Software, but here are some common Linux programs I use and recommend:

Communication and Messaging:

  • Discord: A communication platform designed for gamers that is available on Linux. It allows you to chat, voice call, and video call with friends and communities.
  • Signal: A privacy-focused messaging app that is available on Linux. It provides end-to-end encryption for secure messaging and voice calls.
  • Slack: A collaboration and communication platform that is available on Linux. It allows teams to communicate, share files, and collaborate on projects.
  • Telegram: A messaging app that is available on Linux. It provides secure messaging, file sharing, and group chats.
  • Thunderbird: An email client developed by Mozilla, similar to Microsoft Outlook. It supports multiple email accounts, RSS feeds, and newsgroups.
  • Zoom: A video conferencing and online meeting platform that is available on Linux. It allows you to host and join meetings, webinars, and virtual events.

Development and System Tools:

  • Docker: A platform for developing, shipping, and running applications in containers. It allows you to run applications in isolated environments, making it easier to manage dependencies and configurations.
  • Notepadqq (Notepad++ alternative): A text editor for Linux that provides syntax highlighting, code folding, and other features for programming.
  • Snap and Flatpak: Package management systems that allow you to install and run applications in isolated environments. They provide a way to run applications without worrying about dependencies and compatibility issues.
  • Visual Studio Code: A lightweight code editor developed by Microsoft that supports various programming languages and extensions. It is a popular choice for developers on Linux.

Office and Productivity:

  • Firefox: A popular web browser that is known for its speed, security, and privacy features. It is a great alternative to Google Chrome and Microsoft Edge.
  • LibreOffice: A free and open-source office suite that includes a word processor, spreadsheet application, presentation software, and more. It is a popular alternative to Microsoft Office.
  • Nextcloud: A self-hosted cloud storage solution that allows you to store, share, and sync files across devices. It is a popular alternative to Google Drive and Dropbox.
  • OnlyOffice: An open-source office suite that provides a word processor, spreadsheet editor, and presentation software. It is compatible with Microsoft Office formats and offers collaborative features.

Multimedia and Creative Tools:

  • Audacity: A free and open-source audio editing program that allows you to record, edit, and manipulate audio files. It is a popular choice for podcasting and music production.
  • Blender: A powerful 3D modeling, animation, and rendering software that is widely used in the film and gaming industries. It is a popular alternative to Autodesk Maya and 3ds Max.
  • Calibre: An e-book management software that allows you to organize, convert, and read e-books. It supports various e-book formats and provides features for managing your e-book library.
  • GIMP: A powerful image editing program that is often compared to Adobe Photoshop. It supports a wide range of image formats and provides advanced editing features.
  • Inkscape: A vector graphics editor that is similar to Adobe Illustrator. It is used for creating and editing vector images and supports various file formats.
  • Kdenlive: A non-linear video editor that is popular among Linux users. It provides a wide range of features for video editing, including multi-track editing, effects, and transitions.
  • Krita: A digital painting program that is popular among artists and illustrators. It provides a wide range of brushes, tools, and features for creating digital art.
  • OBS Studio: An open-source software for video recording and live streaming. It is widely used by content creators and streamers on platforms like Twitch and YouTube.
  • Spotify: A music streaming service that is available on Linux. It allows you to listen to millions of songs and create playlists.
  • VLC Media Player: A versatile media player that supports a wide range of audio and video formats. It is a popular alternative to Windows Media Player and QuickTime.

Gaming and Compatibility:

  • Bottles: A tool that allows you to run Windows games and applications on Linux using Wine. It provides a user-friendly interface for managing Wine prefixes and configurations.
  • Heroic Games Launcher: An open-source game launcher for the Epic Games Store that allows you to install and play Epic Games on Linux. It provides a user-friendly interface and supports various game configurations.
  • Lutris: A gaming platform that allows you to install and manage games from various sources, including Steam, GOG, and Battle.net. It provides a unified interface for launching games and managing game libraries.
  • Steam: A digital distribution platform for video games that is available on Linux. It allows you to purchase, download, and play games from a vast library.
  • Wine: A compatibility layer that allows you to run Windows applications on Linux. It is not a perfect solution, but it can be useful for running certain Windows programs that do not have native Linux alternatives.

Linux Gaming

Linux gaming has come a long way in recent years, with many popular games now available natively on the platform. Additionally, tools like Proton (a compatibility layer for running Windows games on Linux) and Lutris (a gaming platform for managing games from various sources) have made it easier to play games on Linux. If you want to play a lot of games on Linux and do not want to do much configuration, I recommend using either Bazzite or Nobara Linux, which are both gaming-focused distributions that come pre-configured with the necessary tools and drivers for gaming. Starting from a fresh blank distribution like Debian or Arch Linux can be challenging for gaming, as you will need to manually install and configure various components to get games running smoothly.

Understanding WINE and Proton

WINE (Wine Is Not an Emulator) is a compatibility layer that allows you to run Windows applications on Linux. It translates Windows API calls into POSIX calls, enabling you to run many Windows applications without needing a full Windows installation. Proton is a modified version of WINE developed by Valve, specifically designed to run Windows games on Linux through the Steam platform. It includes additional libraries and optimizations to improve game compatibility and performance. While WINE and Proton can run many Windows applications and games, they are not perfect solutions. Some applications may not work correctly or may require additional configuration to run smoothly. It is essential to check compatibility reports on sites like ProtonDB to see if a specific game or application is supported and to find any necessary tweaks or workarounds.

Lutris is a front-end for managing games on Linux, providing a user-friendly interface for installing and launching games from various sources, including Steam, GOG, and Battle.net. It supports WINE and Proton, allowing you to run Windows games on Linux with ease. Lutris also provides scripts for installing specific games, which can simplify the setup process.

Heroic Games Launcher is an open-source game launcher for the Epic Games Store that allows you to install and play Epic Games on Linux. It provides a user-friendly interface and supports various game configurations, making it easier to manage your Epic Games library on Linux.

Bottles is a front-end for WINE that simplifies the process of running Windows applications on Linux. It provides a user-friendly interface for managing WINE prefixes and configurations, making it easier to run Windows games and applications without needing extensive knowledge of WINE.

WINE Usage

WINE is a powerful tool for running Windows applications on Linux, but it can be complex to set up and use effectively. Here are some tips for using WINE:

  1. Installation: Install WINE using your distribution's package manager. For example, on Ubuntu, you can use:

    sudo apt install wine
    

    On Arch Linux, you can use:

    sudo pacman -S wine
    
  2. Configuration: After installing WINE, you can run winecfg in the terminal to configure WINE settings. This will create a default WINE prefix in your home directory (~/.wine) and allow you to set various options, such as the Windows version to emulate, graphics settings, and audio configurations.

  3. Installing Windows Applications: To install a Windows application using WINE, you can run the installer executable with the wine command. For example:

    wine setup.exe
    

    Replace setup.exe with the actual name of the installer file. WINE will create a virtual C: drive in your WINE prefix, where the application will be installed.

  4. Running Windows Applications: After installation, you can run the application using WINE by executing the application's executable file. For example:

    wine /path/to/application.exe
    

    Replace /path/to/application.exe with the actual path to the application's executable file.

  5. Managing WINE Prefixes: WINE uses a concept called "prefixes" to manage different environments for running Windows applications. By default, WINE uses the ~/.wine directory as its prefix. You can create additional prefixes by setting the WINEPREFIX environment variable before running WINE commands. For example:

    WINEPREFIX="/path/to/custom/prefix" wine /path/to/application.exe
    

    This allows you to maintain separate configurations and installations for different applications, which can be useful for managing dependencies and settings.

  6. Using Winetricks: Winetricks is a script that helps you install various Windows libraries and components in your WINE prefix. It can be useful for installing .NET Framework, DirectX, and other dependencies required by certain applications. You can install Winetricks using your package manager or download it from the Winetricks GitHub repository.

Wine prefixes can get complicated when adding dotnet and other features with winetricks. Unlike Windows, you cannot UNINSTALL dotnet from a WINE prefix, so it is best to create a new prefix for each application that requires different versions of dotnet or other libraries. This way, you can avoid conflicts and ensure that each application has the correct environment to run smoothly. Once you get the application running, do NOT change the WINE prefix or add/remove libraries, as this can break the application. If you need to make changes, create a new prefix and set it up again. This involves deleting the old prefix and starting fresh, but it is the best way to ensure that your applications run smoothly without conflicts.

Proton Usage

Proton is a compatibility layer developed by Valve that allows you to run Windows games on Linux through the Steam platform. It is built on top of WINE and includes additional libraries and optimizations to improve game compatibility and performance. Here are some tips for using Proton:

  1. Installation: Proton is integrated into the Steam client, so you do not need to install it separately. Make sure you have the latest version of Steam installed on your Linux system. You can install Steam using your distribution's package manager. For example, on Ubuntu, you can use:

    sudo apt install steam
    

    On Arch Linux, you can use:

    sudo pacman -S steam
    
  2. Enabling Proton for all games: To enable Proton for all games, open the Steam client, go to "Settings," then "Steam Play." Check the box for "Enable Steam Play for all other titles" and select the desired Proton version from the dropdown menu.

  3. Installing Proton GE: Proton GE (Glorious Eggroll) is a community-maintained version of Proton that includes additional patches and optimizations for specific games. To install Proton GE, you can download it from the Proton GE GitHub repository.

    After downloading, extract the contents to your Steam directory, typically located at ~/.steam/root/compatibilitytools.d/. If the compatibilitytools.d directory does not exist, you can create it. Once extracted, restart the Steam client, and you should see Proton GE listed as an available compatibility tool in the Steam Play settings.

For updating Proton GE, I'd recommend using the ProtonUp-Qt tool, which provides a user-friendly interface for managing and updating Proton GE installations OR if using the terminal you can use the following command:

protonup -u

This will update Proton GE to the latest version available. Install protonup through python pip:

pip install protonup
Last change: 2025-07-14

Setting up the Perfect Linux Environment

Setting up a Linux environment that suits your needs can be a rewarding experience. Whether you're a developer, a gamer, or just someone who wants a stable and efficient system, Linux offers a wide range of options. In this chapter, we'll explore how to set up the perfect Linux environment tailored to your preferences and requirements.

Xorg vs Wayland

One of the first decisions you'll need to make is whether to use Xorg or Wayland as your display server. Xorg has been the traditional choice for many years, but Wayland is gaining popularity due to its modern architecture and improved performance. Here are some considerations:

  • Xorg: It is widely supported and has a long history of stability. Most applications and desktop environments work seamlessly with Xorg. It is the safe choice for most, but many fear that it will be deprecated and removed in the future. Overall, it is a mature and reliable option.
  • Wayland: It offers better performance and security features, but some applications may not yet be fully compatible. If you're using a modern desktop environment like GNOME or KDE Plasma, Wayland is often the default choice. The downside is its utilities and applications are not as mature as Xorg's, which can lead to compatibility issues with some software. This is especially true for Tiling Window Managers (TWM) and some older applications that rely on X11 features.
  • Recommendation: If you're new to Linux or need maximum compatibility, stick with Xorg for now. If you're comfortable with potential compatibility issues and want to experiment with the latest features, give Wayland a try. Many distributions allow you to choose between the two at login, so you can easily switch if needed.

Desktop Environments

Choosing the right desktop environment (DE) is crucial for your Linux experience. A Desktop Environment provides a complete graphical user interface (GUI) for your system, including a window manager, file manager, and various utilities. Here are some popular options:

  • GNOME: Known for its simplicity and modern design, GNOME is the default DE for many distributions. It offers a clean and intuitive interface, but some users find it too restrictive. I personally do not like GNOME because of the extension installation process from the browser, incompatible extensions on different versions, and the lack of customization options. It is also very resource-intensive. The stock experience reminds me of MacOS, which is not my cup of tea.
  • KDE Plasma: Highly customizable and feature-rich, KDE Plasma is a favorite among power users. It offers a Windows-like experience with a wide range of configuration options. KDE Plasma is my personal favorite because it is highly customizable, has a large number of extensions, and is very stable. It also has a large community and is actively developed, which means it gets regular updates and new features.
  • XFCE: A lightweight DE that is perfect for older hardware or users who prefer a more traditional desktop experience. XFCE is fast and efficient, making it a great choice for those who want a snappy system without the bloat. It is also highly customizable. It is a good choice for those who want a simple and fast desktop environment without the bells and whistles of GNOME or KDE Plasma.
  • Mate: Another lightweight DE that is based on GNOME 2. It is designed to be easy to use and highly customizable. Mate is a great choice for those who want a traditional desktop experience without the resource requirements of more modern environments.
  • Cinnamon: Developed by the Linux Mint team, Cinnamon offers a modern and user-friendly interface. It reminds me of Windows 7. A very polished experience with a focus on usability and ease of use.
  • LXQt: A lightweight DE that is designed to be fast and efficient.
  • Budgie,Enlightenment,Pantheon,Deepin: These are other DEs that offer unique features and aesthetics. They may not be as widely used as the ones mentioned above, but they can provide a fresh and different experience.

Tiling Window Managers (TWM)

If you prefer a more hands-on approach to window management, Tiling Window Managers (TWMs) might be the way to go. TWMs automatically arrange windows in a non-overlapping manner, allowing you to focus on your work without distractions. Some popular TWMs include:

  • i3: A highly configurable and efficient TWM with keyboard-driven window management. Lightweight and fast, ideal for power users who want full control over their desktop environment.
  • Sway: A Wayland-compatible TWM similar to i3. Offers the same keyboard-driven workflow as i3 but designed specifically for Wayland users.
  • bspwm: A binary space partitioning TWM that manages windows through unique tree-based partitioning. Configuration is handled through external tools and shell scripts.
  • Awesome: A TWM that uses Lua scripting for configuration and layout management. Supports both tiling and floating window modes with extensive customization options.
  • dwm: A dynamic TWM designed for simplicity and efficiency. Minimalist approach with configuration done through recompiling the source code.
  • herbstluftwm: A manual tiling window manager with frame-based window management. Uses a command-line interface for configuration and control.
  • Qtile: A TWM written in Python with configuration also done in Python. Appeals to users who prefer Python scripting for customization.
  • Xmonad: A TWM written and configured in Haskell. Offers a purely functional approach to window management with strong type safety.
  • Spectrwm: A minimalist TWM focused on simplicity and efficiency. Lightweight with straightforward configuration through a simple config file.

The big difference between a Tiling Window Manager and a traditional desktop environment is that TWMs do not come with a lot of pre-installed applications or features. They are designed to be lightweight and fast, which means you will need to install your own applications and configure them to work with the TWM. This can be a bit of a learning curve for new users, but it also allows for a lot of flexibility and customization. A good example is configuring your own terminal emulator, file manager, and other essential applications to work seamlessly with the TWM of your choice.

Last change: 2025-07-14