disk-hogs.sh โ find what's eating your disk
One-liners to quickly track down disk usage culprits. Run du as root so it can read all directories.
# Top 20 largest dirs from current location du -ah . | sort -rh | head -20 # Show size of every dir in /var (great for finding log bloat) du -sh /var/*/ | sort -rh # Find files larger than 500MB anywhere on the system find / -type f -size +500M -exec ls -lh {} \; 2>/dev/null # Interactive: ncdu (install it, it's worth it) apt install ncdu && ncdu /
harden-ssh.sh โ lock down SSH access
Key SSH hardening steps after a fresh server install. Always test key auth in a separate session before disabling password login.
# 1. Generate a strong key on your LOCAL machine ssh-keygen -t ed25519 -C "hornt3ch@$(hostname)" # 2. Copy key to server ssh-copy-id -i ~/.ssh/id_ed25519.pub user@192.168.1.50 # 3. On the SERVER โ harden /etc/ssh/sshd_config sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config sed -i 's/#PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config echo "Port 2222" >> /etc/ssh/sshd_config # 4. Restart SSH (keep current session open!) systemctl restart sshd
my-service.service โ create a systemd service
Template for creating a systemd unit file to run any script or app as a persistent service.
# /etc/systemd/system/myapp.service [Unit] Description=My Custom App After=network.target [Service] Type=simple User=hornt3ch WorkingDirectory=/opt/myapp ExecStart=/opt/myapp/run.sh Restart=on-failure RestartSec=5 StandardOutput=journal StandardError=journal [Install] WantedBy=multi-user.target # Reload, enable, and start it systemctl daemon-reload systemctl enable --now myapp journalctl -u myapp -f # follow logs
net-diag.sh โ network troubleshooting toolkit
Essential one-liners for diagnosing network issues on any systemd-based distro.
# Show all interfaces with IPs ip -brief addr show # What's listening on what port? ss -tlnp # Trace route to see where packets die traceroute 1.1.1.1 # DNS lookup dig hornt3ch.com @1.1.1.1 # Watch live network traffic on an interface tcpdump -i eth0 -n -v port 80 # Test if a port is open (no nmap needed) timeout 2 bash -c "cat < /dev/null > /dev/tcp/192.168.1.1/22" \ && echo "OPEN" || echo "CLOSED"
linux-gaming-setup.sh โ Steam + Proton + GameMode
Get Steam + Proton-GE + GameMode + MangoHud running on Debian/Ubuntu. The combo that makes Linux gaming competitive.
# Enable 32-bit support (required for Steam) dpkg --add-architecture i386 apt update # Install Steam apt install steam-installer # Install GameMode and MangoHud apt install gamemode mangohud # Download latest Proton-GE VER="GE-Proton9-20" mkdir -p ~/.steam/root/compatibilitytools.d curl -L "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/$VER/$VER.tar.gz" \ | tar -xz -C ~/.steam/root/compatibilitytools.d/ # Steam launch options to use it all: # PROTON_USE_WINED3D=0 MANGOHUD=1 gamemoderun %command%
pkg-cheatsheet โ apt / dnf / pacman quick ref
Cross-distro package management cheat sheet. Same task, three package managers.
# โโโ INSTALL โโโโโโโโโโโโโโโโโโโโโโโโโโโโ apt install vim # Debian/Ubuntu dnf install vim # Fedora/RHEL pacman -S vim # Arch # โโโ UPDATE ALL โโโโโโโโโโโโโโโโโโโโโโโโโ apt update && apt upgrade dnf upgrade pacman -Syu # โโโ SEARCH โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ apt search htop dnf search htop pacman -Ss htop # โโโ REMOVE + CLEAN โโโโโโโโโโโโโโโโโโโโโ apt autoremove --purge vim dnf autoremove vim pacman -Rns vim
Use
!! and !$ to save keystrokes!! repeats your last command โ so sudo !! re-runs it with sudo. !$ inserts the last argument of the previous command. Type mkdir /some/long/path then cd !$ to jump right in.Always alias your most-used commands
Add to
~/.bashrc: alias ll='ls -lahF --color=auto', alias gs='git status', alias update='sudo apt update && sudo apt upgrade -y'. Run source ~/.bashrc to reload without restarting.Never run
rm -rf without double-checking the pathUse
ls -la /path/to/thing first. Better: install trash-cli and alias rm to trash. The classic horror story is a stray space: rm -rf /home /user instead of /home/user.Ctrl+R is your best friend โ reverse history searchPress
Ctrl+R then start typing any part of a previous command. Keep pressing to cycle through matches. Install fzf to supercharge this with a proper fuzzy finder across your entire history.Use
tmux so SSH sessions survive disconnectsStart with
tmux new -s work. If you disconnect, tmux attach -t work picks up exactly where you left off. Key bindings: Ctrl+B D to detach, Ctrl+B % to split vertically.Check your
/etc/fstab before rebooting after changesA bad fstab entry will drop you into emergency mode. After editing, run
mount -a to test all entries. Use UUIDs from blkid โ not device names like /dev/sdb1 which can change.journalctl is more powerful than you thinkjournalctl -u nginx -f follows a service. journalctl --since "1 hour ago" for time filtering. journalctl -p err for errors only. journalctl --vacuum-size=500M to trim log bloat.Proton Experimental often works better than a numbered version
When a game doesn't run, try Proton Experimental first, then Proton-GE. Check
ProtonDB.com for community-tested settings. PROTON_LOG=1 dumps a detailed log to your home directory.Use
rsync instead of cp for large copiesrsync -avh --progress source/ dest/ gives progress and resumes on interruption. Add --delete to mirror. Add -n for a dry-run preview before committing.๐ Documentation & References
Linux Man Pages Online
man7.org/linux/man-pages
โ
Advanced Bash-Scripting Guide
tldp.org โ the definitive bash reference
โ
Arch Linux Wiki
wiki.archlinux.org โ works for every distro
โ
ExplainShell
explainshell.com โ paste any command, get it explained
โ
๐ ๏ธ Essential Tools
btop โ beautiful system monitor
github.com/aristocratos/btop
โ
fzf โ fuzzy finder for everything
github.com/junegunn/fzf
โ
bat โ cat with syntax highlighting
github.com/sharkdp/bat
โ
Oh My Zsh
github.com/ohmyzsh/ohmyzsh
โ