Loading...
Loading...
Commands, concepts, and cheat sheets - everything you need for the terminal
Copy-paste ready one-liners for everyday tasks.
# Delete all .pyc files recursively
find . -name "*.pyc" -delete
# Delete all __pycache__ directories
find . -type d -name "__pycache__" -exec rm -rf {} +
# Delete files older than 30 days
find /tmp -type f -mtime +30 -delete# Count lines of code (excluding blanks)
find . -name "*.py" | xargs cat | grep -v '^$' | wc -l
# Count files by extension
find . -type f | sed 's/.*\.//' | sort | uniq -c | sort -rn
# Largest files in directory
du -ah . | sort -rh | head -20# Find files containing a string
grep -rl "old_function" src/
# Replace string across all files
find . -name "*.py" -exec sed -i 's/old_func/new_func/g' {} +
# Search and show context
grep -rn -C 3 "ERROR" /var/log/# Kill all processes on a port
lsof -ti:3000 | xargs kill -9
# Watch a command every 2 seconds
watch -n 2 'df -h'
# Run command and get notification when done
long_command; echo "Done!" | mail -s "Task complete" you@email.com