CLOUDSCHOOL.AI · OPERATING SYSTEMS · LINUX

Linux fundamentals, one page and a cheatsheet.

Linux runs most of the cloud, every container and almost every server you will touch. Learn the core ideas in ten minutes, then keep the cheatsheet open while you work. Part of Cloud School Operating Systems.

Eight ideas that make Linux click

Kernel and distributions

Linux is the kernel. A distribution adds the shell, tools, package manager and support. Enterprise picks: RHEL and its rebuilds (Rocky, Alma), Ubuntu Server, SUSE, Debian.

Everything is a file

One tree starts at /. Config lives in /etc, logs and data in /var, users in /home, devices in /dev, kernel info in /proc and /sys.

The shell

bash (or zsh) is how you talk to the system. Small tools do one job each and you chain them with pipes: ps aux | grep nginx. Redirect output with > and >>.

Users, groups and permissions

Every file has an owner, a group and read, write, execute bits for each. root can do anything, so admins work as a normal user and use sudo when needed.

Packages

Install software from signed repositories, never random downloads. RHEL family uses dnf (RPM), Debian and Ubuntu use apt (DEB), SUSE uses zypper.

Services with systemd

systemd starts the system and manages services, timers and logs. systemctl controls services and journalctl reads their logs.

Networking

ip shows addresses and routes, ss shows open ports, NetworkManager or netplan holds the config. Firewalls: firewalld (RHEL) or ufw (Ubuntu) on top of nftables.

Storage

Disks become partitions, often LVM volumes, then file systems (ext4, XFS, Btrfs) mounted into the tree. /etc/fstab mounts them at boot.

Security basics

Patch often, log in with SSH keys not passwords, disable root SSH login, keep SELinux (RHEL) or AppArmor (Ubuntu) enforcing, and open only the ports you need.

The commands you use every day

Add --help to any command, or read its manual with man <command>.

Move around

  • pwd where am I
  • ls -lah list all files with sizes
  • cd /var/log go to a folder, cd - go back
  • tree -L 2 show a folder tree
  • find / -name "*.conf" find files by name

Files and folders

  • cp -r src dst copy, mv a b move or rename
  • rm file, rm -r dir delete (no recycle bin)
  • mkdir -p a/b/c create folders
  • ln -s target link symbolic link
  • tar -czf a.tgz dir pack, tar -xzf a.tgz unpack

Read and search text

  • cat, less, head -n 20, tail -f read files
  • grep -ri "error" /var/log search text
  • wc -l count lines, sort | uniq -c count values
  • cut, awk '{print $1}', sed 's/a/b/g' slice and edit
  • nano or vim edit files

Permissions and users

  • chmod 640 file, chmod +x script.sh
  • chown user:group file change owner
  • sudo command run as root
  • useradd -m alice, passwd alice, usermod -aG wheel alice
  • id, whoami, who who is who

Processes and system

  • top or htop live view
  • ps aux all processes, pgrep nginx find one
  • kill PID, kill -9 PID stop a process
  • free -h memory, uptime load
  • uname -r kernel, cat /etc/os-release distro

Packages

  • sudo dnf install nginx / sudo apt install nginx
  • sudo dnf upgrade / sudo apt update && sudo apt upgrade
  • dnf search x / apt search x
  • dnf remove x / apt remove x
  • rpm -qa / dpkg -l list installed

Services and logs

  • systemctl status nginx
  • sudo systemctl enable --now nginx start now and at boot
  • sudo systemctl restart nginx
  • journalctl -u nginx -f follow a service's log
  • journalctl -p err -b errors since boot

Network

  • ip a addresses, ip r routes
  • ss -tulpn listening ports and their process
  • ping, dig example.com, curl -I https://site
  • ssh user@host, scp file user@host:/tmp
  • sudo firewall-cmd --add-service=http --permanent / sudo ufw allow 80

Disks and storage

  • df -h free space, du -sh * folder sizes
  • lsblk disks and partitions
  • mount /dev/sdb1 /data, umount /data
  • pvs, vgs, lvs LVM overview
  • blkid UUIDs for /etc/fstab
Shortcut or symbolWhat it does
TabComplete a command or path. Press twice to list options.
Ctrl+C / Ctrl+RStop the running command / search command history.
|Pipe: send one command's output into the next.
> / >> / 2>&1Write output to a file / append / include errors.
&& / ||Run the next command only if the last one worked / failed.
~ / . / ..Your home folder / this folder / the parent folder.
rwx = 4 2 1Permission digits: 755 is rwxr-xr-x, 640 is rw-r-----.

From first login to production

01

Get a lab

Run a free VM (Hyper-V, VirtualBox, WSL on Windows) or a small cloud VM with Ubuntu Server or Rocky Linux.

02

Live in the shell

Move around, edit files, use pipes and read man pages until the cheatsheet above feels natural.

03

Administer

Users and sudo, packages, systemd services, logs, networking, firewall and storage with LVM.

04

Automate and secure

bash scripts, cron and systemd timers, SSH keys, SELinux or AppArmor, then Ansible and containers. Scripts on code.cloudschool.ai.

Also run Windows? See windows.cloudschool.ai, or compare both on os.cloudschool.ai.