lsof Command: Find Open Files, Ports and Deleted Files
Use lsof to see which process has a file, directory or port open, list network connections, recover space from deleted files and debug "device busy" errors.
Blog
Linux server administration: Debian, Ubuntu, AlmaLinux, storage, performance and troubleshooting.
Use lsof to see which process has a file, directory or port open, list network connections, recover space from deleted files and debug "device busy" errors.
Start, stop, restart, enable and inspect services with systemctl; list units, read status output, mask services, edit unit files and handle failed services.
Find where CPU time goes with perf: perf top, record and report, profiling one process, flame graphs, symbols for Python, Java and PHP, and VPS caveats.
SELinux on Rocky, AlmaLinux and RHEL: modes, contexts, booleans and ports, reading AVC denials, fixing web server and path issues without disabling it.
Find your kernel version and architecture with uname, read version strings, compare installed and running kernels, and spot a pending reboot.
Use df to check free space on Linux filesystems: readable output, filesystem types, inodes, hiding tmpfs, and what reserved blocks mean.
Grow an LVM volume online: use free VG space, a new disk or a grown partition, lvextend -r for ext4 and XFS, and fix the half-used Ubuntu root LV.
Ubuntu Pro and ESM explained: esm-infra vs esm-apps, universe package coverage, free personal use, pro attach, Livepatch, and when a VPS needs it.
Use who, w, users and loginctl to see current sessions on a Linux server: columns explained, idle time, running commands, remote IPs, messages, and logouts.
Use yq to query and edit YAML: read values, update Docker Compose and Kubernetes manifests in place, merge files, convert YAML and JSON, use it in CI.
First steps on a new Rocky Linux server: updates, a wheel sudo user, key-only SSH, firewalld, SELinux, EPEL, dnf-automatic, Rocky vs AlmaLinux.
Upgrade a Debian server to the next stable release: back up, update first, switch apt sources to trixie, minimal then full upgrade, and checks.
Benchmark server CPUs with sysbench and Geekbench: single vs multi-core, steal time on a VPS, fair comparisons, and when real workload tests are better.
Modify Linux users with usermod: add to groups safely with -aG, change shell, home, username and UID, lock and unlock accounts, and set expiry dates.
Understand every part of the top command: load average, CPU states including steal and iowait, memory, process columns, sorting, filtering and batch mode.
Linux permissions explained: owner, group and others, rwx on files vs directories, octal modes, umask, special bits, ACLs and debugging access.
Work faster in the Linux terminal: cursor and editing keys, Ctrl+R history search, !! and !$, job control with Ctrl+Z, and fixing a frozen terminal.
Handle command-line arguments in Bash scripts: positional parameters, $# and "$@", shift, defaults, usage messages, long options and getopts.
Keep servers reproducible: shell scripts vs cloud-init vs Ansible, Puppet, Chef and Salt, idempotency, secrets, and a practical plan for a few servers.
gzip, bzip2, xz, zstd, lz4, zip and 7z compared by speed and ratio, multi-threaded options, tar usage, and which to use for backups, logs and transfers.
Use Debian backports safely: enable bookworm-backports, install one package with -t, newer kernels, security support, pinning, and alternatives to backports.
Benchmark disks with fio: random 4k IOPS, sequential throughput, mixed database-like tests, latency percentiles, and common benchmarking mistakes.
Rotating backups with rsnapshot: rsync and hard links, rsnapshot.conf, pull backups over SSH with rrsync, retention, cron schedules, restores, and limits.
Split large files on Linux by size or lines with split, join them with cat, verify with checksums, split logs and CSVs, split backups on the fly, and csplit.