OWN YOUR
SYSTEM

// The foundation of modern computing.

LINUX IS EVERYWHERE.

From servers powering the internet to Android phones, smart devices, and supercomputers, Linux runs the world. Understanding Linux gives you control over the infrastructure that powers our digital lives.

WHY LINUX?

Linux is free and open source. You can inspect every line of code, modify it for your needs, and share your changes. No vendor lock-in, no forced updates, no surveillance.

TAKE BACK CONTROL.

The terminal isn't scary—it's empowering. When you understand Linux, you understand how computers actually work. You become the master, not the user.

BEGIN YOUR JOURNEY →

// The Path to Mastery

12 lessons. Complete system control.

LESSON 01

Introduction to Linux & FOSS Philosophy

History, philosophy, and why Linux matters

Beginner
LESSON 02

The Terminal - Your Command Center

Navigate and control your system via CLI

Beginner
LESSON 03

File System Navigation

cd, ls, pwd, and directory structure

Beginner
LESSON 04

File Permissions & Ownership

chmod, chown, and access control

Intermediate
LESSON 05

Process Management

ps, top, kill, and managing running processes

Intermediate
LESSON 06

Text Manipulation & Pipelines

grep, sed, awk, and pipe operations

Intermediate
LESSON 07

Shell Scripting Basics

Variables, loops, and writing automation scripts

Intermediate
LESSON 08

System Services

systemd, service management, and cron jobs

Intermediate
LESSON 09

Networking Tools

ip, ss, curl, and network configuration

Intermediate
LESSON 10

Storage Management

df, du, mounting, and disk management

Advanced
LESSON 11

System Monitoring

htop, vmstat, iostat, and log analysis

Advanced
LESSON 12

Linux Security

SELinux, permissions, and security hardening

Advanced

// Why Linux

Linux was created by Linus Torvalds in 1991 as a free alternative to UNIX. Today, it's the backbone of the internet—over 96% of the world's top web servers run Linux.

But Linux isn't just for servers. It's for anyone who wants true ownership of their computing. Whether you're a developer, system administrator, security researcher, or curious learner, Linux gives you freedom.

The four freedoms of free software: Run the program for any purpose, study how it works, redistribute copies, and distribute your modified versions. This is the philosophy that powers the open source world.

Your computer, your rules. Learn Linux.

// Tools & References

📖 Linux Documentation

Official Linux documentation

kernel.org/doc

🐧 Ubuntu Docs

Ubuntu community documentation

help.ubuntu.com

📚 Linux From Scratch

Build your own Linux distribution

linuxfromscratch.org

🔧 Arch Wiki

Excellent community wiki

wiki.archlinux.org

📜 GNU Coreutils

Documentation for core utilities

gnu.org/software/coreutils

🖥️ Explainshell

Parse and explain shell commands

explainshell.com

// Introduction to Linux & FOSS Philosophy

×

What is Linux?

Linux is a free and open-source operating system kernel first released by Linus Torvalds in 1991. Unlike Windows or macOS, Linux is not a single product—it's a kernel that forms the foundation of hundreds of unique distributions (distros).

The FOSS Philosophy

Free in FOSS means freedom, not price. The four essential freedoms are:

  • Freedom 0: Run the program as you wish, for any purpose
  • Freedom 1: Study how the program works, and change it
  • Freedom 2: Redistribute copies so you can help others
  • Freedom 3: Distribute copies of your modified versions
WHY THIS MATTERS: When you run proprietary software, you're trusting the vendor blindly. With FOSS, anyone can inspect the code for backdoors, vulnerabilities, or spyware. This is essential for true privacy and security.

Popular Linux Distributions

  • Ubuntu: User-friendly, great for beginners
  • Debian: The foundation of many distros, rock-stable
  • Fedora: Cutting-edge, community-driven
  • Arch Linux: Rolling release, build from scratch
  • Linux Mint: Extremely beginner-friendly
  • Tails: Privacy-focused, runs from USB

Getting Started

You don't need to replace your OS to learn Linux. Options include:

  • Live USB: Boot Linux from a USB without installing
  • Virtual Machine: Run Linux inside your current OS
  • WSL: Linux on Windows (limited but useful)
  • Dual Boot: Install alongside your existing OS
$ cat /etc/os-release NAME="Ubuntu" VERSION="22.04.1 LTS (Jammy Jellyfish)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 22.04.1 LTS"

Quiz

1. Linux was first released by _____ in 1991.

Hint: The Finnish developer who created the Linux kernel

2. FOSS stands for _____ and Open Source Software.

Hint: Think

3. A Linux _____ is a complete operating system built on the Linux kernel.

Hint: Often abbreviated as

4. The _____ philosophy emphasizes freedom to run, study, redistribute, and modify software.

Hint: Free and Open Source Software

Show Answers

Answers

  1. linus torvalds
  2. free
  3. distribution
  4. foss

// The Terminal - Your Command Center

×

Why Use the Terminal?

The terminal (or shell) is your direct interface with Linux. While graphical interfaces are nice, the terminal offers:

  • Speed: Accomplish tasks faster than clicking through menus
  • Power: Access functionality unavailable in GUIs
  • Automation: Script repetitive tasks
  • Control: Know exactly what your computer is doing
PRIVACY NOTE: The terminal doesn't send your data to corporate servers. It doesn't track your usage. It's just you and your computer.

Basic Commands

The Echo Command

$ echo "Hello, rebel!" Hello, rebel!

Date and Time

$ date Mon Feb 23 12:00:00 UTC 2026

Who Am I?

$ whoami user

View System Information

$ uname -a Linux rebel 5.15.0-91-generic #101-Ubuntu SMP x86_64 GNU/Linux

Getting Help

$ man echo ECHO(1) User Commands ECHO(1) NAME echo - display a line of text SYNOPSIS echo [STRING]... DESCRIPTION The echo command writes arguments to standard output.
$ echo --help Usage: echo [OPTION]... [STRING]... Echo the STRING(s) to standard output.

Command Structure

Most commands follow this pattern: command [options] [arguments]

$ ls -l /home -rw-r--r-- 1 user user 4096 Feb 23 12:00 /home/user

Here, ls is the command, -l is an option (flag), and /home is the argument.

Quiz

1. The command to display text is _____.

Hint: Like shouting in a canyon

2. To see your username, use the _____ command.

Hint: It literally asks

3. The _____ command displays the manual for another command.

Hint: Short for

4. In

Hint: Also called a flag

Show Answers

Answers

  1. echo
  2. whoami
  3. man
  4. option

// File System Navigation

×

Understanding the Linux File System

Linux organizes everything under a single directory tree. Unlike Windows (C:, D:, etc.), Linux has one unified hierarchy.

Key Directories

  • / - Root (the top of the tree)
  • /home - User home directories
  • /etc - System configuration files
  • /bin - Essential binaries (programs)
  • /usr - User programs
  • /var - Variable data (logs, caches)
  • /tmp - Temporary files
  • /root - Root user's home
  • /boot - Boot files
  • /dev - Device files
SECURITY NOTE: The /etc directory contains sensitive configuration files. Only modify these when you understand what you're doing. Many are readable by anyone but writable only by root.

Navigation Commands

Print Working Directory

$ pwd /home/user

List Files

$ ls Documents Downloads Pictures Music
$ ls -la total 64 drwxr-xr-x 1 user user 4096 Feb 23 12:00 Documents drwxr-xr-x 1 user user 4096 Feb 23 12:00 Downloads -rw-r--r-- 1 user user 1024 Feb 23 12:00 readme.txt

Change Directory

$ cd Documents $ pwd /home/user/Documents
$ cd .. $ pwd /home/user

Special Directories

  • . - Current directory
  • .. - Parent directory
  • ~ - Home directory
  • - - Previous directory

Creating and Removing

$ mkdir myproject $ touch readme.txt $ rm readme.txt $ rmdir myproject

Quiz

1. The top of the Linux directory tree is called _____.

Hint: Represented by /

2. User home directories are located in _____.

Hint: Like C:\Users on Windows

3. The command to change directories is _____.

Hint: Short for

4. The _____ character represents your home directory.

Hint: Tilde

Show Answers

Answers

  1. root
  2. /home
  3. cd
  4. ~

// File Permissions & Ownership

×

Understanding Permissions

In Linux, every file and directory has permissions that control who can read, write, or execute it. This is fundamental to Linux security.

PRIVACY CONNECTION: Proper permissions ensure your personal files remain private. Without them, other users on your system could read your sensitive documents or encryption keys.

Permission Types

  • r (read) - View file contents or list directory
  • w (write) - Modify file or add/remove files in directory
  • x (execute) - Run file as program or access directory

Viewing Permissions

$ ls -l /etc/passwd -rw-r--r-- 1 root root 1234 Feb 23 12:00 /etc/passwd

The string -rw-r--r-- breaks down as:

  • - - File type (- = regular file, d = directory)
  • rw- - Owner permissions (read, write, no execute)
  • r-- - Group permissions (read only)
  • r-- - Other permissions (read only)

Permission Numbers

Permissions can also be represented numerically:

  • r = 4
  • w = 2
  • x = 1

So rw-r--r-- = 644 (owner has 4+2=6, others have 4)

And rwxr-xr-x = 755 (owner has all, others can read/execute)

And rwx------ = 700 (only owner can do anything)

Changing Permissions

$ chmod 700 secret.txt $ chmod +x script.sh $ chmod go-w file.txt

Flags: u=user (owner), g=group, o=others, a=all

Ownership

$ ls -l /var/log/syslog -rw-r----- 1 syslog adm 12345 Feb 23 12:00 /var/log/syslog

File ownership is shown as user:group. The syslog file is owned by syslog user, adm group.

Changing Ownership

$ chown user:group file.txt $ chown -R user:group directory/

Special Permissions

  • SetUID (4000) - Run as file owner
  • SetGID (2000) - Run as group owner
  • Sticky Bit (1000) - Only owner can delete

Quiz

1. The permission to view file contents is _____.

Hint: Represented by

2. The command to change ownership is _____.

Hint: CHange OWNership

3. To make a file private, use chmod _____.

Hint: Only owner can access

4. In -rwxr-xr-x, the owner

Hint: Read, write, execute

Show Answers

Answers

  1. read
  2. chown
  3. 700
  4. rwx

// Process Management

×

What is a Process?

A process is a running program. Every command you execute starts one or more processes. Understanding processes gives you complete control over your system.

Viewing Processes

Process Status (ps)

$ ps PID TTY TIME CMD 1234 pts/0 00:00:00 bash 5678 pts/0 00:00:00 ps
$ ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 2384 1504 ? Ss 12:00 0:02 /sinit root 234 0.0 0.0 4321 2800 ? S 12:00 0:00 /bin/bash user 567 0.0 0.1 12345 6789 pts/0 Ss 12:00 0:00 bash

Top - Real-time Process Monitor

$ top top - 12:00:00 up 5 days, 1:23, 1 user, load average: 0.52, 0.58, 0.59 Tasks: 245 total, 1 running, 244 sleeping, 0 stopped, 0 zombie %Cpu(s): 5.2 us, 1.3 sy, 0.0 ni, 93.5 id, 0.0 wa MiB Mem : 8192.0 total, 2048.0 free, 3072.0 used, 3072.0 buff/cache MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 4096.0 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1234 root 20 0 512344 45000 12000 S 2.0 0.5 0:05.32 Xorg

Process IDs (PID)

Every process has a unique Process ID. The first process (init/systemd) is always PID 1.

Signals - Controlling Processes

Signals are how you communicate with processes:

  • SIGTERM (15) - Graceful termination (recommended)
  • SIGKILL (9) - Force kill (emergency only)
  • SIGSTOP (19) - Pause process
  • SIGCONT (18) - Resume paused process

Killing Processes

$ kill 12345 # Send SIGTERM to process 12345
$ kill -9 12345 # Force kill process 12345 (SIGKILL)
$ pkill firefox # Kill all processes named firefox

Background Processes

$ sleep 100 & # Run sleep in background (&)
$ jobs # List background jobs
$ fg %1 # Bring job 1 to foreground

Priority (Nice Values)

Process priority ranges from -20 (highest) to +19 (lowest). Higher priority = more CPU time.

$ nice -n 10 ./script.sh # Run script with lower priority
$ renice +5 12345 # Change priority of running process

Quiz

1. Every process has a unique _____.

Hint: Process ID

2. Signal _____ forces immediate termination.

Hint: Signal number 9

3. The _____ command shows real-time process activity.

Hint: Like Task Manager on Windows

4. To run a command in the background, add _____.

Hint: Ampersand

Show Answers

Answers

  1. pid
  2. sigkill
  3. top
  4. &

// Text Manipulation & Pipelines

×

The Power of Text

In Linux, text is king. Most configuration is done through text files, and the tools to manipulate text are incredibly powerful. This is why FOSS is so powerful—you can understand and modify everything.

Viewing Files

cat - Concatenate and Display

$ cat /etc/hostname rebel

head - First Lines

$ head -n 5 /etc/passwd root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync

tail - Last Lines

$ tail -f /var/log/syslog # Follow the log file in real-time

Searching Text

grep - Pattern Matching

$ grep "root" /etc/passwd root:x:0:0:root:/root:/bin/bash
$ ps aux | grep firefox # Find firefox process

Case-Insensitive Search

$ grep -i "error" logfile.txt # Find all error variations (ERROR, Error, error)

Pipes - Connecting Commands

Pipes (|) send the output of one command as input to another. This is called composition.

$ ls -la /etc | grep ".conf" # List config files in /etc
$ ps aux | sort -k4 -r | head -10 # Top 10 memory-consuming processes

Text Processing

wc - Word Count

$ wc -l /etc/passwd 42

cut - Extract Columns

$ cut -d: -f1 /etc/passwd # Extract usernames (first field, colon-delimited)

sort - Sort Lines

$ ps aux | sort -k4 -r # Sort by memory usage, descending

uniq - Remove Duplicates

$ sort file.txt | uniq # Unique lines in sorted order

awk - Advanced Text Processing

$ df -h | awk '{print $1 ": " $5}' # Show filesystem and usage

sed - Stream Editor

$ sed 's/old/new/g' file.txt # Replace all occurrences of 'old' with 'new'

Quiz

1. The _____ command searches for patterns in text.

Hint: Global Regular Expression Print

2. The _____ symbol (|) sends output from one command to another.

Hint: It connects commands together

3. To view the first 10 lines of a file, use the _____ command.

Hint: Opposite of

4. The _____ command counts lines, words, and characters.

Hint: Word Count

Show Answers

Answers

  1. grep
  2. pipe
  3. head
  4. wc

// Shell Scripting Basics

×

Why Learn Shell Scripting?

Shell scripting allows you to automate repetitive tasks, combine multiple commands into single operations, and create powerful system administration tools. It's the foundation of system automation on Linux.

AUTOMATION POWER: A well-written script can replace hours of manual work. System administrators use scripts to deploy servers, monitor systems, backup data, and manage user accounts—all automatically.

Creating Your First Script

$ cat > hello.sh << 'EOF' #!/bin/bash # This is my first script echo "Hello, Linux World!" echo "Today's date is: $(date)" EOF

Making Scripts Executable

$ chmod +x hello.sh $ ./hello.sh Hello, Linux World! Today's date is: Mon Feb 23 12:00:00 UTC 2026

Variables

$ cat > variables.sh << 'EOF' #!/bin/bash NAME="Rebel" YEAR=2026 echo "Hello, $NAME!" echo "Current year: ${YEAR}" EOF

User Input

$ cat > input.sh << 'EOF' #!/bin/bash read -p "Enter your name: " USERNAME echo "Welcome, $USERNAME!" EOF

Conditional Statements

$ cat > check_file.sh << 'EOF' #!/bin/bash if [ -f "$1" ]; then echo "File exists: $1" else echo "File does not exist: $1" fi

Loops

$ cat > loop.sh << 'EOF' #!/bin/bash # For loop for i in {1..5}; do echo "Iteration: $i" done # While loop count=1 while [ $count -le 3 ]; do echo "Count: $count" ((count++)) done

Functions

$ cat > functions.sh << 'EOF' #!/bin/bash my_function() { echo "Parameter 1: $1" echo "Parameter 2: $2" } my_function "Hello" "World"

Exit Codes

Every command returns an exit code: 0 means success, non-zero means failure.

$ ls /tmp; echo "Exit code: $?" Exit code: 0

Quiz

1. The first line of a bash script is called the _____.

Hint: Starts with #!/bin/bash

2. To make a script executable, use chmod _____.

Hint: Add execute permission

3. The _____ command reads user input into a variable.

Hint: Like reading from stdin

4. An exit code of _____ indicates success.

Hint: Zero means no errors

Show Answers

Answers

  1. shebang
  2. +x
  3. read
  4. 0

// System Services

×

Understanding systemd

systemd is the system and service manager for most modern Linux distributions. It manages startup processes, services, and system states. Understanding systemd is essential for system administration.

SYSTEM CONTROL: systemd replaced the traditional init system and provides parallelized startup, on-demand daemon activation, and powerful dependency management. It controls everything from networking to logging.

Checking Service Status

$ systemctl status sshd ● sshd.service - OpenSSH server daemon Loaded: loaded (/lib/systemd/system/sshd.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2026-02-23 10:00:00 UTC Main PID: 1234 (sshd)

Starting and Stopping Services

$ sudo systemctl start nginx # Start the nginx service
$ sudo systemctl stop nginx # Stop the nginx service
$ sudo systemctl restart nginx # Restart the nginx service

Enabling and Disabling Services

Enable means the service starts automatically at boot. Disable prevents auto-start.

$ sudo systemctl enable sshd Created symlink /etc/systemd/system/multi-user.target.wants/sshd.service...
$ sudo systemctl disable sshd # Remove from auto-start

Listing All Services

$ systemctl list-units --type=service UNIT LOAD ACTIVE SUB DESCRIPTION sshd.service loaded active running OpenSSH server daemon nginx.service loaded active running A high performance web server cron.service loaded active running Regular background program processing

Systemd Timers (Cron Replacement)

$ systemctl list-timers NEXT LEFT LAST PASSED UNIT Mon 2026-02-23 00:00:00 UTC 11h left Sun 2026-02-22 00:00:00 UTC 13h ago apt-daily.timer

Traditional Cron Jobs

$ crontab -l # Edit with: crontab -e 0 2 * * * /usr/local/bin/backup.sh */5 * * * * /usr/local/bin/monitor.sh
CRON SYNTAX: Minute Hour Day Month DayOfWeek. * means "every". 0 2 * * * means "2:00 AM daily". */5 means "every 5 minutes".

System Targets (Runlevels)

$ systemctl get-default graphical.target
$ sudo systemctl isolate multi-user.target # Switch to multi-user mode (no GUI)

Quiz

1. The command to manage systemd services is _____.

Hint: System Control

2. To start a service at boot, use systemctl _____.

Hint: Opposite of disable

3. The traditional job scheduler in Linux is called _____.

Hint: Chronological

4. The command to view your cron jobs is crontab _____.

Hint: List/Show

Show Answers

Answers

  1. systemctl
  2. enable
  3. cron
  4. -l

// Networking Tools

×

Modern Networking Commands

Linux provides powerful networking tools for diagnostics, monitoring, and configuration. The `ip` command has replaced deprecated tools like ifconfig, route, and arp.

NETWORK DIAGNOSTICS: Understanding networking tools is crucial for troubleshooting connectivity, analyzing traffic, and securing your system. These are essential skills for any Linux administrator.

ip Command - Modern Network Tool

$ ip addr show 1: lo: mtu 65536 ... inet 127.0.0.1/8 scope host lo 2: eth0: mtu 1500 ... inet 192.168.1.100/24 brd 192.168.1.255 scope global dynamic eth0
$ ip link show 2: eth0: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 00:1a:2b:3c:4d:5e brd ff:ff:ff:ff:ff:ff
$ ip route show default via 192.168.1.1 dev eth0 proto dhcp metric 100 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.100

Socket Statistics (ss)

The `ss` command replaces netstat and provides faster, more detailed socket information.

$ ss -tuln Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port udp UNCONN 0 0 0.0.0.0:68 0.0.0.0:* tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:* tcp LISTEN 0 128 0.0.0.0:80 0.0.0.0:* tcp LISTEN 0 128 0.0.0.0:443 0.0.0.0:*
SS OPTIONS: -t = TCP, -u = UDP, -l = listening sockets, -n = numeric (no DNS lookup), -p = show processes.

Ping - Test Connectivity

$ ping -c 4 google.com PING google.com (142.250.80.46) 56(84) bytes of data. 64 bytes from google.com: icmp_seq=1 ttl=117 time=15.2 ms 64 bytes from google.com: icmp_seq=2 ttl=117 time=14.8 ms 4 packets transmitted, 4 received, 0% packet loss

curl - Transfer Data

$ curl -I https://example.com HTTP/2 200 content-type: text/html; charset=UTF-8 server: ECS (nyb/1CDB)
$ curl -o file.zip https://example.com/file.zip # Download file to disk

wget - File Downloader

$ wget https://example.com/large-file.iso --2026-02-23 12:00:00-- https://example.com/large-file.iso Resolving example.com... 93.184.216.34 Connecting to example.com|93.184.216.34|:443... connected. Saving to: 'large-file.iso' large-file.iso 100%[==================>] 1.50G 25.5MB/s in 60s

traceroute - Trace Network Path

$ traceroute google.com traceroute to google.com (142.250.80.46), 30 hops max 1 192.168.1.1 (192.168.1.1) 1.234 ms 1.123 ms 1.098 ms 2 isp-gateway.net (10.0.0.1) 5.432 ms 5.321 ms 5.287 ms

netcat - Network Swiss Army Knife

$ nc -zv 192.168.1.1 22 Connection to 192.168.1.1 22 port [tcp/ssh] succeeded!
$ nc -l 8080 # Listen on port 8080 for connections

Quiz

1. The modern replacement for ifconfig is the _____ command.

Hint: Short and modern

2. The _____ command replaces netstat for socket statistics.

Hint: Socket Statistics

3. To download a file from the command line, use _____ or wget.

Hint: Client URL

4. The _____ command traces the network path to a destination.

Hint: Trace the route

Show Answers

Answers

  1. ip
  2. ss
  3. curl
  4. traceroute

// Storage Management

×

Disk Management Fundamentals

Understanding storage management is critical for system administration. From partitioning disks to managing LVM volumes and configuring mount points, these skills ensure your data is safe and accessible.

DATA PROTECTION: Always backup data before making storage changes. Disk operations can be destructive. Use virtual machines to practice before working on production systems.

Listing Disk Information

$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 100G 0 disk ├─sda1 8:1 0 512M 0 part /boot ├─sda2 8:2 0 20G 0 part / └─sda3 8:3 0 79.5G 0 part /home sdb 8:16 0 50G 0 disk
$ df -h Filesystem Size Used Avail Use% Mounted on udev 3.9G 0 3.9G 0% /dev /dev/sda2 20G 15G 4.5G 77% / /dev/sda3 79G 45G 32G 59% /home

Partitioning with fdisk

$ sudo fdisk /dev/sdb Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-104857599, default 2048): Last sector ...: +10G Created a new partition 1 of type 'Linux' and of size 10 GiB.

Creating Filesystems

$ sudo mkfs.ext4 /dev/sdb1 mke2fs 1.46.5 (30-Dec-2021) Creating filesystem with 2621440 4k blocks and 655360 inodes Filesystem UUID: 1234-abcd-5678-efgh Writing superblocks and filesystem accounting information: done

Mounting Filesystems

$ sudo mkdir /mnt/data $ sudo mount /dev/sdb1 /mnt/data $ mount | grep /mnt/data /dev/sdb1 on /mnt/data type ext4 (rw,relatime)

Permanent Mounts (fstab)

$ cat /etc/fstab # UUID=abc123... / ext4 errors=remount-ro 0 1 UUID=def456... /home ext4 defaults 0 2 /dev/sdb1 /mnt/data ext4 defaults 0 2
FSTAB FIELDS: device, mount point, filesystem type, mount options, dump (backup), pass (fsck order). Use 0 for pass on data partitions, 1 for root, 2 for other system partitions.

Logical Volume Manager (LVM)

LVM provides flexible disk management by abstracting physical disks into logical volumes.

$ sudo pvcreate /dev/sdb Physical volume "/dev/sdb" successfully created
$ sudo vgcreate vg_data /dev/sdb Volume group "vg_data" successfully created
$ sudo lvcreate -L 20G -n lv_storage vg_data Logical volume "lv_storage" created

Extending Volumes

$ sudo lvextend -L +10G /dev/vg_data/lv_storage Size of logical volume vg_data/lv_storage changed from 20.00 GiB to 30.00 GiB
$ sudo resize2fs /dev/vg_data/lv_storage Filesystem at /dev/vg_data/lv_storage is now 7864320 blocks long

Quiz

1. The command to view disk partition information is _____.

Hint: List Block devices

2. The file _____ defines permanent filesystem mounts.

Hint: /etc/fstab

3. LVM stands for _____ Volume Manager.

Hint: Not physical

4. To create an ext4 filesystem, use the _____ command.

Hint: Make filesystem

Show Answers

Answers

  1. lsblk
  2. fstab
  3. logical
  4. mkfs.ext4

// System Monitoring

×

Real-Time System Monitoring

System monitoring is essential for identifying performance bottlenecks, detecting resource exhaustion, and ensuring system stability. Linux provides numerous tools for real-time and historical monitoring.

PERFORMANCE TUNING: Understanding resource usage patterns helps you optimize systems for better performance and plan capacity upgrades before hitting limits.

top - Classic Process Viewer

$ top top - 12:00:00 up 5 days, 1:23, 1 user, load average: 0.52, 0.58, 0.59 Tasks: 245 total, 1 running, 244 sleeping, 0 stopped, 0 zombie %Cpu(s): 5.2 us, 1.3 sy, 0.0 ni, 93.5 id, 0.0 wa, 0.0 hi, 0.0 si MiB Mem : 8192.0 total, 2048.0 free, 3072.0 used, 3072.0 buff/cache MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 4096.0 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1234 root 20 0 512344 45000 12000 S 2.0 0.5 0:05.32 Xorg 5678 user 20 0 234567 89012 34000 S 1.5 1.1 0:03.21 firefox
TOP COLUMNS: PID (Process ID), USER (owner), %CPU (CPU usage), %MEM (memory usage), VIRT (virtual memory), RES (resident memory), TIME+ (CPU time), COMMAND (process name).

htop - Interactive Process Viewer

$ htop 1 [|||||||||||||||| 25.0%] Tasks: 45, 2 thr; 1 running 2 [|||||||||| 12.5%] Load average: 0.52 0.58 0.59 Mem [||||||||||||||| 3.00G/8.00G] Swp [ 0K/2.00G] PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 1234 root 20 0 500M 450M 120M S 2.0 5.6 0:05.32 nginx 5678 user 20 0 230M 89M 34M S 1.5 1.1 0:03.21 sshd

htop features: Color-coded display, mouse support, visual CPU/memory bars, easier process killing (F9), sorting by any column (F6).

vmstat - Virtual Memory Statistics

$ vmstat 1 5 procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 1 0 0 2048000 123456 2345672 0 0 12 15 234 567 5 2 93 0 0 0 0 0 2048123 123456 2345678 0 0 0 0 123 234 2 1 97 0 0
VMSTAT COLUMNS: r (running), b (blocked), swpd (swapped), free (free memory), si/so (swap in/out), bi/bo (blocks in/out), us/sy/id/wa (user/system/idle/wait CPU).

iostat - I/O Statistics

$ iostat -x 2 Linux 5.15.0-91-generic (rebel) 02/23/2026 _x86_64_ avg-cpu: %user %nice %system %iowait %steal %idle 5.25 0.00 1.30 0.05 0.00 93.40 Device r/s w/s rkB/s wkB/s await sda 12.34 45.67 123.45 567.89 2.34 sdb 0.12 0.34 1.23 4.56 5.67

System Logs with journalctl

$ sudo journalctl -b # View boot logs
$ sudo journalctl -u sshd -f # Follow sshd service logs in real-time
$ sudo journalctl --since "1 hour ago" # View logs from last hour

Traditional Log Files

$ sudo tail -f /var/log/syslog Feb 23 12:00:01 rebel CRON[1234]: (root) CMD (/usr/local/bin/backup.sh) Feb 23 12:00:05 rebel sshd[5678]: Accepted publickey for user from 192.168.1.100
$ sudo tail -f /var/log/auth.log # Authentication and security logs

dmesg - Kernel Ring Buffer

$ dmesg | tail -20 [ 12.345678] usb 1-1: new high-speed USB device number 2 using xhci_hcd [ 12.456789] usb 1-1: New USB device found, idVendor=1234, idProduct=5678

Quiz

1. The enhanced version of top with colors and mouse support is _____.

Hint: H for human-friendly

2. The command to view virtual memory statistics is _____.

Hint: Virtual Memory Statistics

3. systemd logs are viewed using the _____ command.

Hint: Journal Control

4. Kernel messages are viewed with the _____ command.

Hint: Diagnostic Message

Show Answers

Answers

  1. htop
  2. vmstat
  3. journalctl
  4. dmesg

// Linux Security

×

Defense in Depth

Linux security is multi-layered, combining mandatory access controls, auditing, integrity checking, and least-privilege principles. Understanding these tools is essential for protecting systems and data.

SECURITY MINDSET: Security is not a product you buy, it's a process. Layer your defenses—no single tool provides complete protection. Monitor, audit, and verify continuously.

SELinux - Security-Enhanced Linux

SELinux is a mandatory access control (MAC) system that enforces security policies at the kernel level.

$ getenforce Enforcing
$ sestatus SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: targeted Current mode: enforcing
$ ls -Z /etc/passwd system_u:object_r:passwd_file_t:s0 /etc/passwd

AppArmor - Alternative MAC

AppArmor is another MAC system, used primarily on Ubuntu and SUSE. It uses profiles to confine programs.

$ sudo aa-status apparmor module is loaded. 14 profiles are loaded. 14 profiles are in enforce mode. /usr/sbin/mysqld /usr/sbin/nginx /usr/sbin/sshd

Auditd - System Auditing

$ sudo auditctl -l -w /etc/passwd -p wa -k identity -w /etc/group -p wa -k identity -a always,exit -F arch=b64 -S setuid -k privilege_escalation
$ sudo ausearch -k identity -ts today ---- time->Mon Feb 23 12:00:00 2026 type=SYSCALL msg=audit(1234567890.123:12345): arch=c000003e syscall=257 success=yes ... auid=1000 uid=0 gid=0 euid=0 suid=0 ... comm="vim" exe="/usr/bin/vim" ...

AIDE - File Integrity Checker

AIDE (Advanced Intrusion Detection Environment) monitors file integrity and detects unauthorized changes.

$ sudo aide --init AIDE initialized database at /var/lib/aide/aide.db.new.gz
$ sudo aide --check AIDE found differences between database and filesystem!! Summary: Total number of entries: 12345 Added entries: 0 Removed entries: 0 Changed entries: 3

File Permissions Best Practices

$ find /home -type f -perm /o+w # Find files world-writable (security risk)
$ find / -perm -4000 -type f 2>/dev/null # Find SetUID files (potential privilege escalation)

SSH Security

$ cat /etc/ssh/sshd_config | grep -E "^(Port|PermitRootLogin|PasswordAuthentication)" Port 22 PermitRootLogin no PasswordAuthentication no
SSH HARDENING: Disable root login, use key authentication only, change default port, use fail2ban to block brute force attempts, and keep software updated.

Firewall with nftables/iptables

$ sudo nft list ruleset table inet filter { chain input { type filter hook input priority filter; policy drop; ct state established,related accept iif "lo" accept tcp dport { 22, 80, 443 } accept } }

Quiz

1. SELinux stands for Security-_____ Linux.

Hint: Improved or strengthened

2. The command to check SELinux status is _____.

Hint: SE Linux Status

3. _____ is an alternative to SELinux used on Ubuntu.

Hint: Application Armor

4. AIDE stands for Advanced Intrusion _____ Environment.

Hint: Finding intrusions

Show Answers

Answers

  1. enhanced
  2. sestatus
  3. apparmor
  4. detection