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' EXIT
Load functions/variables
source ~/.bashrc
Display a line of text
echo 'Hello, World!'
Background/foreground processes
firefox & # Start in background
fg %1 # Bring to foreground
Detach process from shell
long_running.sh &
disown
Run commands immune to hangups
nohup ./server.sh > output.log &
Display a tree of processes
pstree
Netcat swiss army knife
nc -zv example.com 80 # Port scan
💡 Combine with pipes for network testing
VPN over SSH
sshuttle -r user@server 0/0
Network diagnostic tool
mtr -rw example.com
Download files from the web
wget https://example.com/file.zip
Trace system calls
strace -f -e trace=file ls
List shared lib dependencies
ldd /usr/bin/bash
GNU Debugger
gdb -p $(pidof process)
Interactive process viewer
htop
Enhance 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