Linux Operating Systems Fundamentals · Lessons 1–4
Linux Operating Systems Fundamentals Study Guide: Lessons 1–4
Review command-line tools, text streams, package and process management, hardware and storage, and file management for Lessons 1–4.
How to use this guide
This guide combines the Lessons 1–4 chapter material. It is organized by lesson so you can connect the shell and its text tools to the software that runs on a system, the hardware and storage underneath it, and the files you manage on top of it.
Study in this order:
- Learn the vocabulary, commands, and options in the lesson summaries.
- Explain the key comparisons and decision rules in your own words.
- Practice the commands in a lab VM, then revisit the high-yield distinctions across the lessons.
Many questions hinge on one exact option letter or one exact path. When a table lists an option, learn what it does and what the similar-looking options do instead.
The ideas that connect all four lessons
Linux administration is a stack of layers, and each lesson adds one:
- Lesson 1 — the shell and text: commands, help, editors, filters, regular expressions, redirection, and pipes.
- Lesson 2 — software and processes: package managers (RPM and Debian families), shared libraries, and running programs.
- Lesson 3 — hardware and storage: firmware, devices, kernel modules, partitions, LVM, filesystems, and mounting.
- Lesson 4 — files: creating, copying, moving, deleting, archiving, linking, securing, and finding files.
One rule appears in every lesson: identify the target first (which shell, which package, which device, which file), then run the command that changes it.
Lesson 1 — Exploring Linux Command-Line Tools
Linux, GNU, and distributions
- The Linux kernel was written by Linus Torvalds. It was not developed as part of the GNU’s Not Unix (GNU) project, but it grew quickly because the GNU tools (compiler, shell, utilities) were already available to build a complete system around it.
- A distribution bundles the kernel, GNU tools, and other software with a package manager and installer.
- Linux runs on many CPU architectures, including x86 (32-bit), x86-64 (64-bit, also called AMD64), and ARM. AMD is a CPU manufacturer and BSD is a separate Unix-like OS — neither is a CPU type.
The shell
- A shell reads your commands and runs them. Bash is the most common default; others include Dash, KornShell, tcsh, and Z shell.
- The prompt is output from the shell. The
PS1environment variable defines the default Bash prompt; its default is usually set in a system file such as/etc/profileor/etc/bashrc, and users can customize it. - Command history: press the up arrow to recall recently typed commands;
historylists them. - Tab completion finishes command and file names.
- The root user’s home directory is
/root. Regular users’ home directories are under/home. - Internal (builtin) commands such as
cdrun inside the shell. External commands are programs found by searching the directories inPATH.
| Command | Purpose |
|---|---|
pwd |
Print the working (current) directory |
cd |
Change directory (cd ~ or just cd goes home) |
echo |
Display text or a variable’s value |
type / which |
Show how a command name will be run / where its program is |
uname -a |
Display kernel, host, and CPU architecture information |
uptime |
Show current time, how long the system has run, logged-in users, and load averages for the past 1, 5, and 15 minutes |
export / env |
Export a variable to child processes / list environment variables |
Getting help
| Tool | What it does |
|---|---|
man command |
Opens the manual page, displayed through the less pager |
man -k keyword |
Searches man page names and descriptions — same as apropos keyword |
whatis keyword |
Searches only the Name sections of man pages (same as man -f) |
info command |
Hypertext-style GNU documentation |
help builtin |
Help for shell builtins |
Text editors
| Editor | Key facts |
|---|---|
| vi / vim | Modal: command mode (default), insert mode (i), and ex mode (:) |
| nano | Simple text-mode editor with on-screen shortcuts |
| emacs | Runs as a text-mode program in a text console and provides a GUI version in a graphical environment |
| gedit / KWrite | GUI-only editors |
vi commands to know:
| Keystroke | Effect |
|---|---|
i |
Enter insert mode; Esc returns to command mode |
o / O |
Open a new blank line below / above the current line |
yy / dd / p |
Yank (copy) / delete a line / paste |
:w |
Save (write) the file — Ctrl+S does not save in vi |
:q / :wq / :q! |
Quit / save and quit / quit without saving |
Watch the letter case: lowercase o opens a line below the cursor and uppercase O opens one above.
Viewing and processing text
| Command | Key facts |
|---|---|
cat |
Display or concatenate files |
head / tail |
First / last 10 lines by default; use tail -n 20 file for 20 lines; tail -f follows a growing log |
less / more |
Page through text |
cut |
Extract fields or characters; the default delimiter is Tab; -d sets another delimiter, -f selects fields |
wc |
Count lines, words, and characters; -l lines, -w words, -c bytes, -m characters (the character count) |
sort / uniq |
Sort lines / remove adjacent duplicates |
tr |
Translate or delete characters |
join / paste |
Merge files on a shared field / side by side |
grep |
Print lines matching a pattern |
sed |
Stream editor for scripted edits |
Linux can also modify graphics files from the command line (for example, ImageMagick’s convert), not just text.
Regular expressions
| Symbol | Meaning |
|---|---|
^ |
Start of a line |
$ |
End of a line |
. |
Any single character |
* |
Zero or more of the preceding item |
[abc] |
One character from the set |
| (ERE) |
Alternation — separates two strings where either one may match |
+, ?, (), {} (ERE) |
One or more, zero or one, grouping, counted repetition |
grep -E (historically egrep) enables extended regular expressions.
grep '^root' /etc/passwd
grep -E 'error|warning' app.log
Streams, redirection, and pipes
Every program has three standard streams: STDIN (0), STDOUT (1), and STDERR (2).
| Operator | Effect |
|---|---|
> |
Create or overwrite a file with standard output |
>> |
Append standard output to a file |
2> |
Create or overwrite a file with standard error |
2>> |
Append standard error to a file |
&> |
Send both standard output and standard error to a file |
< |
Read standard input from a file |
<< |
Here document — read input until a marker line |
| |
Pipe: send one command’s output to the next command’s input |
sort < names.txt > sorted.txt
command 2>> errors.log
command > all.log 2>&1
cut -d: -f1 /etc/passwd | sort | uniq
find . -name '*.log' | xargs wc -l
Lesson 1 terms to know
kernel, GNU, distribution, x86, x86-64, shell, Bash, prompt, PS1, history, PATH, builtin, /root, uname, uptime, man, less, apropos, man -k, whatis, info, vi, command mode, insert mode, ex mode, nano, emacs, head, tail, cut, wc, sort, uniq, grep, sed, regular expression, STDIN, STDOUT, STDERR, redirection, pipe, and xargs.
Lesson 2 — Managing Software and Processes
Package systems and distributions
A package manager tracks installed files, versions, and dependencies in a database.
| Package format | Used by |
|---|---|
RPM (.rpm) |
Red Hat Enterprise Linux, Fedora, CentOS, openSUSE, Mandriva |
Debian (.deb) |
Debian, Ubuntu, Linux Mint |
Tarballs (.tgz) |
Slackware |
| ebuilds | Gentoo (source-based Portage system) |
| pacman | Arch Linux |
Low-level tools (rpm, dpkg) work with a single package file. High-level tools (yum/dnf, zypper, apt) use repositories and resolve dependencies automatically.
RPM and YUM
| Command | Purpose |
|---|---|
rpm -i / -U / -F |
Install / upgrade or install / freshen (upgrade only if installed) |
rpm -e |
Erase (remove) a package |
rpm -qi |
Query package information |
rpm -ql |
List files in an installed package |
rpm -qlp file.rpm |
List files in a package file that has not been installed |
rpm -qf /path/file |
Which package owns a file |
rpm -V |
Verify that no installed files have been altered since installation; no output means nothing changed |
rpm2cpio pkg.rpm |
Convert an RPM to a cpio archive, written to STDOUT by default |
yum install / remove / update |
Repository-based transactions |
yum search / yum info |
Search / show details, including a package’s version and release |
yumdownloader |
Download an RPM without installing it (part of the yum-utils package) |
The primary YUM configuration file is /etc/yum.conf; repositories are defined in /etc/yum.repos.d/. Newer RPM systems use dnf, which works the same way.
Debian packages and APT
| Command | Purpose |
|---|---|
dpkg -i |
Install a local .deb — dpkg is the essential low-level Debian tool |
dpkg -r / -P |
Remove (keep configuration) / purge (remove configuration too) |
dpkg -L / -S |
List a package’s files / find which package owns a file |
apt-get update |
Refresh the package lists from repositories |
apt-get upgrade |
Update installed packages to the latest versions |
apt-get install / remove |
Install / remove with dependency resolution |
apt-cache search zsh |
Search package names and descriptions |
apt-cache show |
Show package details |
dpkg-reconfigure |
Rerun a package’s configuration |
Watch for fake commands: apt-get search and apt-cache locate do not exist.
Shared libraries
A library is a collection of software routines that other programs can use. Its licensing terms matter to programmers who link against it (for example, the LGPL).
| Tool or file | Purpose |
|---|---|
ldd program |
List the shared libraries a program needs |
ldconfig |
Update the links and cache for shared libraries |
ldconfig -n dirs |
Process only the directories named on the command line, not those in /etc/ld.so.conf |
ldconfig -p |
Print the current cache |
/etc/ld.so.conf and /etc/ld.so.conf.d/ |
Library search directories |
LD_LIBRARY_PATH |
Environment variable adding temporary search directories |
Processes
- A process is a running program with a PID. The process that launches another is its parent; the new one is the child. The parent’s ID is the PPID.
ps(for example,ps auxorps -ef) takes a snapshot of running processes.topshows a live, sorted view. Both are text-mode tools to identify running processes. (dfshows disk space andbgis a job-control command.)uname -aidentifies the CPU architecture;/proc/cpuinfoandlscpugive full CPU details.freeshows memory use.
Foreground, background, and job control
| Action | How |
|---|---|
| Start in the background | Put & after the command: long_command & |
| List jobs | jobs |
| Bring a job to the foreground | fg (for example, fg %1) |
| Suspend the foreground job | Ctrl+Z |
| Resume a stopped job in the background | bg |
Priority and signals
nice -n 10 commandstarts a program with lower priority;renicechanges a running process. Ordinary users can only lower priority.kill PIDsends SIGTERM (15) by default;kill -9 PIDsends SIGKILL, which cannot be caught. SIGHUP (1) often makes a daemon reload.killallandpkillselect processes by name.
Lesson 2 terms to know
package, dependency, RPM, Debian package, tarball, ebuild, rpm, rpm -qlp, rpm -V, rpm2cpio, yum, yum info, yumdownloader, /etc/yum.conf, dnf, dpkg, apt-get, apt-cache search, library, ldd, ldconfig, /etc/ld.so.conf, LD_LIBRARY_PATH, process, PID, parent process, ps, top, &, jobs, fg, bg, nice, renice, kill, SIGTERM, and SIGKILL.
Lesson 3 — Configuring Hardware
Firmware
- BIOS is legacy firmware that usually pairs with MBR partitioning.
- UEFI is modern firmware that usually pairs with GPT and loads a boot loader from the EFI System Partition (ESP), which Linux mounts at
/boot/efi. A GPT disk on a UEFI system needs this partition (typically 100–250 MB) to boot.
Devices and the kernel’s view
| Location or tool | What it shows |
|---|---|
/dev |
Device files, such as /dev/sda |
/proc/interrupts |
Current IRQ assignments (cat /proc/interrupts) |
/proc/ioports, /proc/dma |
I/O port and DMA assignments |
/proc/kallsyms |
Available kernel symbols (/proc/ksyms on legacy systems) |
/proc/sys/kernel |
Kernel settings such as the release number, domain name, and location of modprobe |
/sys |
Devices, drivers, and buses in the kernel’s device model |
lspci |
PCI devices; -k shows the kernel driver modules for each device; -n shows vendor and device IDs as numbers |
lsusb |
USB devices; -t shows them in a tree |
lsblk |
Block devices (disks and partitions) |
Hotplug, coldplug, and udev
- A hotplug device can be connected and removed while the computer runs, such as a USB drive.
- A coldplug device must be installed with the power off, such as a PCI card.
- udev creates device files in
/devas hardware appears.udevadm infoqueries the udev database about a device, andudevadm monitorshows kernel and udev events in real time.
Kernel modules
| Command or file | Purpose |
|---|---|
lsmod |
List loaded modules |
modinfo |
Show a module’s details |
modprobe |
Load a module and its dependencies |
modprobe -r |
Remove a module and unused dependencies |
insmod / rmmod |
Load / remove a single module with no dependency handling; rmmod -f forces removal. The course material lists rmmod -w as the option for removing unused modules (older rmmod versions used -w to wait until a module was no longer in use) |
/etc/modprobe.d/ |
Module configuration, including blacklist entries that stop modprobe from loading a module |
Disk interfaces and device names
| Interface | Linux name |
|---|---|
| PATA (older IDE) | /dev/hda, /dev/hdb (/dev/hdX) |
| SATA, SCSI, and USB | /dev/sda, /dev/sdb (/dev/sdX) |
| NVMe | /dev/nvme0n1, partition /dev/nvme0n1p1 |
A number after the name is a partition: /dev/sda1 is the first partition on the first SATA/SCSI disk.
Partitioning: MBR versus GPT
| MBR | GPT |
|---|---|
| Up to four primary partitions; one can be an extended partition holding logical partitions | Up to 128 partitions, no primary/extended distinction |
| Pairs with BIOS | Pairs with UEFI; needs an ESP at /boot/efi to boot |
Tools: fdisk, parted |
Tools: gdisk, parted, modern fdisk |
Common separate partitions: /boot, / (root), /home, /var, and swap.
LVM and RAID
LVM builds flexible storage in three layers:
| Step | Command |
|---|---|
| Initialize a partition as a physical volume (PV) | pvcreate /dev/sdb1 |
| Pool PVs into a volume group (VG) | vgcreate vgdata /dev/sdb1 |
| Carve out a logical volume (LV) | lvcreate -L 10G -n lvapps vgdata |
| List PVs / VGs / LVs | pvscan or pvdisplay / vgdisplay / lvdisplay |
RAID levels: 0 striping (speed, no redundancy), 1 mirroring, 5 single parity, 6 double parity, 10 mirrored stripes. RAID is not a backup.
Filesystems
| Filesystem | Notes |
|---|---|
| ext4 | Standard journaling Linux filesystem |
| XFS, JFS, ReiserFS, Btrfs | Other Linux filesystems suitable for an installation |
| FAT / VFAT / exFAT | Removable media shared with other systems |
| NTFS | Windows filesystem |
| HFS / HFS+ | Apple filesystem — an inappropriate choice to hold most of a Linux installation |
| ISO-9660 | Traditional CD-ROM filesystem |
| UDF | Newer optical format for DVDs and Blu-ray; UDF replaces ISO-9660, not the other way around |
| Command | Purpose |
|---|---|
mkfs -t ext4 /dev/sdb1 or mkfs.ext4 |
Create a filesystem |
mkswap |
Prepare a partition as swap space |
swapon / swapoff |
Enable / disable swap space |
mount / umount |
Attach / detach a filesystem at a mount point |
/etc/fstab |
Filesystems to mount at boot; prefer UUID= or LABEL= over device names |
fsck |
Check and repair a filesystem (unmount it first) |
df / du |
Free space per filesystem / space used by files and directories |
blkid |
Show UUIDs, labels, and filesystem types |
The initial RAM disk
An initial RAM disk (initramfs/initrd) holds the drivers the kernel needs to reach the root filesystem at boot. On CentOS 6 and later Red Hat–family systems, dracut creates it; older systems used mkinitrd.
Lesson 3 terms to know
BIOS, UEFI, EFI System Partition, /boot/efi, /dev, /proc, /sys, IRQ, /proc/interrupts, /proc/kallsyms, /proc/sys/kernel, lspci -k, lspci -n, lsusb -t, hotplug, coldplug, udev, udevadm info, udevadm monitor, kernel module, lsmod, modprobe, insmod, rmmod, /etc/modprobe.d, blacklist, PATA, SATA, /dev/sdX, MBR, GPT, primary partition, extended partition, LVM, pvcreate, vgcreate, lvcreate, pvscan, RAID, ext4, HFS, ISO-9660, UDF, mkfs, mkswap, swapon, mount, /etc/fstab, fsck, initramfs, and dracut.
Lesson 4 — Managing Files
Filenames and globbing
- Linux filenames are case-sensitive; a leading dot makes a file hidden.
- Globbing is the use of wildcards in filename specifications. The shell expands them before the command runs.
| Wildcard | Matches |
|---|---|
? |
Exactly one character |
* |
Zero or more characters |
[abc], [a-z] |
One character from a set or range |
Basic file commands
| Command | Key facts |
|---|---|
ls |
Display the names of files in a directory; -l long listing, -a hidden files, -i inode numbers |
pwd |
Display the directory you are working in |
touch file |
Create a new empty file if it doesn’t exist, or update the timestamps of an existing one |
mkdir -p |
Create a directory and any missing parents |
cp |
Copy; -R/-r recursive (includes subdirectories), -i/--interactive prompt before overwriting, -p/--preserve keep ownership and timestamps, -a/--archive also copies a whole tree |
mv |
Move or rename; -i prompts before overwriting, -f forces |
rm |
Delete files; -r recursive, -i prompt, -f force |
rmdir |
Delete an empty directory |
An ordinary user cannot delete any file on the system with rm. Deleting a file requires write and execute permission on the directory that contains it; only root can delete everything.
Example: copy a directory and all its subdirectories to a USB drive.
cp -R ~/important /media/usb
Compression and archives
| Tool | Key facts |
|---|---|
gzip / gunzip |
.gz; fast, but compresses less than bzip2 |
bzip2 / bunzip2 |
.bz2; smaller files than gzip, slower |
xz / unxz |
.xz; usually the smallest files |
zip / unzip |
.zip; archives and compresses; -9 is maximum compression, -1 fastest |
tar |
Archives directory trees: c create, x extract, t list, f archive file, v verbose, z gzip, j bzip2, J xz |
cpio |
Archive tool that reads a file list from standard input |
dd |
Copies raw blocks (if= input, of= output) |
zip -9 trip.zip holiday.tif desc.txt
tar -czvf project.tgz Project/
tar -zxf project.tgz
Links
- A hard link (
ln source newname) is a second name for the same inode. It cannot cross filesystems or point to a directory. - A symbolic link (
ln -s target linkname) stores a path to another file. It can cross filesystems and breaks if the target is deleted.
Ownership and permissions
chown user:group filechanges the owner (and group);chgrp group filechanges the group only.- Permissions are read (4), write (2), and execute (1) for the owner, group, and others.
chmod 750 filemeansrwxr-x---. - Symbolic form:
chmod u+x,chmod g-w,chmod o=,chmod a+r. - umask removes permissions from new files (base 666) and directories (base 777). With
umask 022, files are 644 and directories are 755. - Special bits: SUID (run as the file’s owner), SGID (run as the file’s group, or new files inherit a directory’s group), and the sticky bit (users can delete only their own files in a shared directory like
/tmp).
The Filesystem Hierarchy Standard (FHS)
| Directory | Contents |
|---|---|
/bin, /sbin |
Essential commands (often merged into /usr) |
/boot |
Kernel and boot loader files |
/etc |
System configuration files |
/home |
Users’ home directories |
/root |
Root user’s home directory |
/usr |
Installed programs that run on the system, plus their libraries and shared data |
/var |
Changing data: logs, mail queues, caches |
/tmp |
Temporary files |
/opt |
Add-on software packages |
/media |
Mount points for removable media such as USB flash drives (most distributions) |
/mnt |
Temporary mount point for administrators |
Finding files
| Command | How it searches |
|---|---|
locate |
Searches a database of filenames (mlocate.db in /var/lib/mlocate/) for a name or name fragment; refresh it with updatedb |
whereis |
Searches a limited set of directories for a command’s binary, source, and man page |
which |
Finds the program that runs from your PATH |
find |
Searches the live filesystem by any criteria |
find tests to know:
| Test | Meaning |
|---|---|
-name '*.log' |
By filename pattern |
-user alice / -uid 1000 |
Files owned by a user (by name or by user ID) |
-group / -gid |
Files owned by a group |
-size +1G |
Larger than 1 GB (+ = more than, - = less than; units k, M, G) |
-type f / -type d |
Regular files / directories |
-perm |
By permission bits |
find / -size +1G
find /home -user alice -type f
find / -perm /6000 -type f 2>/dev/null
Lesson 4 terms to know
case-sensitive, hidden file, globbing, wildcard, ls, pwd, touch, mkdir, cp -R, cp -i, --interactive, mv -i, rm, rmdir, gzip, bzip2, xz, zip -9, tar, cpio, dd, hard link, symbolic link, inode, chown, chgrp, chmod, umask, SUID, SGID, sticky bit, FHS, /usr, /var, /etc, /media, locate, updatedb, whereis, which, find, -user, -uid, and -size.
Course Notes