Bash One-Liners Worth Remembering
Twenty powerful bash one-liners every sysadmin should know—file ops, process hunting, networking, text processing, disk analysis
All the articles with the tag "bash".
Twenty powerful bash one-liners every sysadmin should know—file ops, process hunting, networking, text processing, disk analysis
Master bash for loops, while loops, and seq for sequential counting — iterate over files, ranges, and arrays without losing your mind.
Count files in a directory (recursively or not) with find, ls, and tree — quick one-liners for when du just isn't telling you enough.
Your disk is full and du is lying to you. ncdu, df, and find tricks to track down space hogs before your server goes down at 2 AM.
Extract tar.gz, tar.bz2, tar.xz — flags demystified, compression compared, directory extraction, and the gotchas that trip you up.
Use su with a specific shell to switch users without the default login shell — useful when /etc/passwd points to something unexpected.
logrotate keeps your /var/log from eating the disk — configure rotation schedules, compression, and retention for any service log.
Clean up empty directories with find and rmdir — safely prune orphaned dirs left after file migrations.
Remove spaces and special characters from filenames using bash loops, rename, find, and parameter expansion tricks.
sed is the stream editor for making text substitutions, deletions, and insertions in files — the patterns you'll use 90% of the time.
Switch your default shell to zsh on Linux — why zsh beats bash, installation, Oh My Zsh setup, essential plugins, and the gotcha that still catches everyone.
You committed .env.production once. Your database credentials are in git forever. Here's how to use dotenv without shooting yourself.