Servers linux
Guides for Linux servers: packages, users, disk, memory, services, SSH, and deployment checklists. Covers common failure modes and recovery.
- easy 33
- medium 18
- hard 2
Easy
- How to use cron and scheduled tasks
Schedule recurring commands with cron: edit crontab -e, use the five fields (minute hour day month weekday), and log output to a file or to journal. Use systemd timers as an alternative for services. Verify the job runs and check logs when it fails.
- Linux filesystem hierarchy and essential paths
Learn the standard Linux directory layout: /etc for config, /var for variable data, /home for users, /tmp for temporary files. Find where config, logs, and binaries live so you can back up, restore, and troubleshoot without guessing.
- How to back up files with tar and rsync
Create full or incremental backups with tar (archives) and rsync (mirror or incremental), store them off the host, and verify with listing or checksum. Use this for config and data backup before changes or for scheduled retention.
- How to check disk usage and clean up space
Find what is using disk space with du and df, locate large files and dirs, and free space by removing logs, caches, and old packages. Use this when the disk is full or you need to prevent full before it happens.
- How to add and remove Linux users
Create and delete user accounts with useradd and userdel (or adduser on Debian), set passwords and SSH keys, and assign users to groups. Use this to grant shell or SFTP access without sharing root and to clean up when someone leaves.
- How to find and diagnose processes on Linux
List and filter processes with ps, pgrep, and top; find what is using CPU or memory; send signals (kill, killall) and interpret state (D, Z, R). Use this to debug high load, stuck processes, or what is bound to a port.
- How to install a package with apt or dnf
Install a single package on Debian/Ubuntu (apt install) or RHEL/Fedora (dnf install), resolve dependencies, and verify the binary and config location. Use this when you need a specific tool or service and the distro provides it.
- How to manage services with systemd
Start, stop, restart, and enable systemd units; check status and read logs with journalctl. Use this to bring services up after boot, restart after config changes, and diagnose why a unit failed.
- How to kill and send signals to processes
Send SIGTERM or SIGKILL to a process with kill or killall; use signals to stop, reload, or force-stop. Understand what each signal does so you can stop runaway or stuck processes safely.
- Linux packages and system updates
Install, upgrade, and remove packages on Debian/Ubuntu (apt) and RHEL/Fedora (dnf/yum). Run updates safely: check changelogs, take backups, and verify services after reboot. Use this to keep servers patched without breaking running workloads.
- Permission denied: how to fix it on Linux
Diagnose and fix permission denied on files, directories, and SSH. Check owner, group, and bits with ls; fix with chmod and chown; for SSH check authorized_keys and server-side permissions. Never use chmod 777 as a fix.
- Pre-deployment checklist for Linux servers
Before going live: verify hostname, time, network, firewall, SSH, updates, backups, monitoring, and app config. Use this so nothing is left in default or broken state when the server is put in production.
- How to resolve DNS and use /etc/hosts
Configure and test DNS resolution: set nameservers in resolv.conf or netplan, use getent and dig to verify; add static entries in /etc/hosts when you need a fixed name without DNS. Use this when the server cannot resolve hostnames or you need to override a name.
- Servers Linux topic checklist
Convergence checklist for the servers-linux topic: ensure you have covered fundamentals, operations, failure recovery, and hardening. Use this to confirm you have the right guides for your role and to find the next step when you are stuck.
- Linux shell and essential commands
Use the Linux shell to navigate, inspect, and change the system: cd, ls, cat, grep, find, ps, systemctl, and redirection. Verify commands with exit codes and output so you can operate and debug servers without a GUI.
- Sudo and privilege escalation on Linux
Grant and revoke sudo access: add users to the sudo or wheel group, or add rules in /etc/sudoers and /etc/sudoers.d. Use visudo to avoid syntax errors. Restrict commands or require a password so only authorized users run as root.
- What is a Linux server and when to use one
Define a Linux server as a headless machine or VM that runs services and accepts network requests. Learn when to choose a server over a workstation, and what access (SSH, console) and skills you need before provisioning or installing Linux for services.
- Understanding Linux users, groups, and permissions
Understand how Linux file and process permissions work: owner, group, and others; read, write, execute; numeric modes and chmod/chown. Use this to fix permission denied errors and to grant least privilege to services and users without using chmod 777.
- Why can't I SSH into the server
Diagnose SSH connection failures: check network (ping, port open), sshd running, firewall allows port 22, and key or password accepted. Use this when SSH connection is refused, times out, or permission denied so you can fix or use console access.
- How to add an APT or DNF package repository
Add a third-party or vendor repository to APT (sources.list or .list in sources.list.d) or DNF (.repo in /etc/yum.repos.d) so you can install packages from it. Use this when you need software not in the default distro repos, and to keep repo config auditable and reversible.
- How to set environment variables persistently
Set environment variables for a user in ~/.profile, ~/.bashrc, or ~/.bash_profile, and for a systemd service in the unit file or EnvironmentFile. Use this when an app or script needs VAR=value across logins or at service start.
- How to check disk I/O and identify heavy usage
Use iostat, iotop, and /proc/diskstats to see disk throughput and which processes are doing the most I/O. Use this when the system is slow and CPU and memory look fine, or when tuning storage or diagnosing latency.
- How to check memory usage
Use free, /proc/meminfo, and top or smem to see total RAM, used, free, buffers, cache, and swap. Identify processes by RSS or VSZ. Use this when diagnosing high memory use, before adding swap, or when tuning application memory limits.
- How to set and check file descriptor limits
Check and raise the open file limit (nofile) for the shell with ulimit, and for a systemd service or system-wide with limits.conf or the unit file. Use this when you see 'too many open files' or when running high-connection services.
- How to find large files and free space
Use du, find, and ncdu to locate the largest files and directories so you can free disk space or move data. Use this when a filesystem is full or you need to identify what is consuming space before cleanup or resizing.
- How to add swap and size it
Create a swap file or partition, enable it with swapon, and add it to fstab so it survives reboot. Size swap based on workload: often equal to RAM for small servers, or less when you have plenty of RAM. Use this when you see OOM or need to reduce memory pressure.
- How to change the default boot target
Set the default systemd target (multi-user vs graphical) with systemctl set-default so the system boots to the desired run level. Use this when converting a desktop install to headless, or to force graphical or console-only boot.
- How to read and filter journald logs
Use journalctl to view systemd journal logs by unit, time, priority, or boot. Follow logs in real time, filter by service name, and export for debugging. Use this when diagnosing service failures, boot issues, or security events.
- When and how to reboot safely
Schedule a reboot during a maintenance window; notify users, stop or drain services if needed, run reboot or shutdown -r, and verify the system and services after boot. Use this when applying kernel or critical updates, or recovering from a hung state.
- How to check and interpret SELinux status
Check whether SELinux is enabled and in enforcing or permissive mode with getenforce and sestatus; read denials in the audit log or ausearch. Use this when access is denied and permissions look correct, or when hardening or debugging a RHEL/CentOS/Fedora system.
- How to set and change the hostname
Set the system hostname persistently with hostnamectl or by editing /etc/hostname and /etc/hosts. Use this when provisioning a server, cloning a VM, or fixing duplicate hostnames so the machine has a unique, predictable name for logs and SSH.
- How to set timezone and sync time with NTP
Set the system timezone with timedatectl or a symlink in /usr/share/zoneinfo, and enable NTP (systemd-timesyncd or chrony) so the clock stays correct. Use this when deploying a server, fixing certificate or log ordering issues, or after restoring a snapshot.
- How to use SSH config and key agent
Configure SSH client with ~/.ssh/config for hosts, keys, and options; use ssh-agent to hold keys so you do not type passphrases repeatedly. Use this to simplify SSH and SCP to servers and to avoid exposing keys to every command.
Medium
- Disk full: how to recover
Recover when the root or critical partition is full: free space quickly by clearing logs and caches, find and remove or move large files, then fix rotation and monitoring so it does not recur. Use this when the system is read-only or services fail with no space.
- Corrupt package database or package: how to recover
Fix broken apt or dnf state: repair dpkg with apt --fix-broken or dpkg --configure -a; clear lock files; reinstall the package or restore the package list from backup. Use this when apt or dnf fails with dependency or status errors.
- How to configure a firewall with ufw or nftables
Enable and configure a host firewall with ufw (Ubuntu/Debian) or nftables (RHEL/modern): allow SSH first, then HTTP/HTTPS or app ports; deny by default. Verify with ufw status or nft list ruleset so the server is protected and still reachable.
- How to configure networking: static and DHCP
Set a static IP or use DHCP on Linux using netplan (Ubuntu), nmcli (NetworkManager), or /etc/network/interfaces. Verify with ip addr and ping; ensure DNS and default route work so the server is reachable and can reach the internet.
- High CPU: how to diagnose and fix
Find which process is using CPU with top, ps, or pidstat; identify the thread or code path; fix the cause (loop, leak, or load) or throttle and scale. Use this when the system is slow or load average is high and you need to pinpoint the consumer.
- Incident response checklist for Linux servers
When something is wrong: preserve logs and state, identify scope (one host or many), restore service or isolate, then root-cause and fix. Use this so incidents are handled consistently and evidence is kept for post-mortem.
- Log rotation and journald configuration
Prevent logs from filling the disk: configure logrotate for app logs and limit journald size (SystemMaxUse, RuntimeMaxUse). Verify rotation runs and disk usage stays bounded so the system does not crash from a full disk.
- How to mount disks and configure fstab
Mount a disk or partition manually with mount, add an entry to /etc/fstab for boot mount, and verify with mount and df. Use this when adding data disks or moving data to a new volume so the system mounts it correctly after reboot.
- Network connectivity failure: how to diagnose
When the server cannot reach the network or others cannot reach it: check interface, IP, route, DNS, and firewall. Use ping, ip, ss, and traceroute to isolate whether the problem is local, routing, or remote.
- LVM basics: create and extend volume groups
Create physical volumes, volume groups, and logical volumes with pvcreate, vgcreate, lvcreate; extend an LV when you add disk or need more space. Use this when you want flexible storage that can grow or span disks.
- Out of memory (OOM): how to diagnose and fix
Diagnose OOM: check dmesg and journalctl for oom-killer, identify the process killed and what was using memory; fix by adding RAM, limiting process memory, or fixing leaks. Use this when the system kills processes or becomes unresponsive and logs show out-of-memory.
- How to partition and format a disk
Create a partition table and partitions with fdisk or parted, format with mkfs.ext4 or mkfs.xfs, then mount and add to fstab. Use this when adding a new data disk so the system can use it safely after reboot.
- Read-only filesystem: how to recover
When a filesystem is mounted read-only due to errors or full disk: free space if full, run fsck to repair errors, then remount read-write. Use this when writes fail with 'read-only file system' or after an unclean shutdown.
- How to restore files from a backup
Restore from a tar archive or rsync backup to the original or a new path; verify permissions and service config; bring services back up and confirm the app works. Use this after data loss or to roll back a bad change.
- How to secure an SSH server
Harden sshd: disable password auth and root login, allow only key-based auth, use a non-default port if desired, and restrict users with AllowUsers. Verify with a new session before closing the current one so you do not lock yourself out.
- Linux server hardening checklist
Checklist for securing a new or existing Linux server: SSH key-only and no root login, firewall default deny, updates, non-root service user, minimal packages, and logging. Use this before putting a server in production or during a security review.
- Service won't start: how to fix it
Diagnose why a systemd unit fails to start: read journalctl -u UNIT, check config and paths, fix permissions and dependencies (sockets, mounts), then restart. Use this when systemctl start fails or the unit is in failed state.
- Slow performance: how to diagnose
When the server is slow: check load average, CPU, memory, disk I/O, and network; use top, iostat, and vmstat to find the bottleneck. Use this to decide whether to scale, optimize, or fix a bug.
Hard
- Package dependency conflicts: how to resolve
When apt or dnf reports dependency conflicts or broken packages: identify the conflicting packages, choose to remove or replace, use --fix-broken or manual dependency resolution. Use this when install or upgrade fails due to dependency loops or version conflicts.
- How to troubleshoot boot failure
When Linux fails to boot, use rescue or recovery mode from the installer or a live image to mount the root filesystem, fix fstab or initramfs, and repair broken config. Use this when the system hangs at boot, drops to emergency mode, or fails to mount root.