Elevate your command line expertise with professional-grade tools, automation strategies, and system-level mastery
Shebang for bash scripts
#!/bin/bash
# Simple backup script
tar -czf backup-$(date +%F).tar.gz /data💡 Use set -euo pipefail for safer scripts
Handle signals and cleanup
trap 'rm -f tempfile' EXITLoad functions/variables
source ~/.bashrcDisplay a line of text
echo 'Hello, World!'Background/foreground processes
firefox & # Start in background
fg %1 # Bring to foregroundDetach process from shell
long_running.sh &
disownRun commands immune to hangups
nohup ./server.sh > output.log &Display a tree of processes
pstreeNetcat swiss army knife
nc -zv example.com 80 # Port scan💡 Combine with pipes for network testing
VPN over SSH
sshuttle -r user@server 0/0Network diagnostic tool
mtr -rw example.comDownload files from the web
wget https://example.com/file.zipTrace system calls
strace -f -e trace=file lsList shared lib dependencies
ldd /usr/bin/bashGNU Debugger
gdb -p $(pidof process)Interactive process viewer
htopEnhance your shell with ZSH features:
zmv '(*).txt' '${1}.md'Advanced command combinations:
Master tmux workflows:
Recursive force delete root
Prevention: alias rm='rm -i'
Disk destruction
Prevention: Triple-check input/output files
Fork bomb
Prevention: ulimit -u to limit processes
Permission chaos
Prevention: Use 755 for dirs, 644 for files