Given: pixelcraft-server.log (10,000 lines)
wc -l pixelcraft-server.log # How many lines?
grep "ERROR" pixelcraft-server.log | wc -l # How many errors?
grep "ERROR" pixelcraft-server.log | head -5 # First 5 errors
grep "ERROR" pixelcraft-server.log | tail -5 # Last 5 errors
Chain commands to find the top 10 most common error messages:
grep "ERROR" pixelcraft-server.log \
| sort \
| uniq -c \
| sort -rn \
| head -10
Redirect output to files for later analysis:
grep "ERROR" pixelcraft-server.log > errors-only.log
wc -l errors-only.log
find ~/pixelcraft-workspace -name "*.txt" # All text files
find ~/pixelcraft-workspace -name "*.txt" -type f # Only files (not dirs)
find . -name "*.log" -size +100k # Large log files
In one command, find all JavaScript files and count total lines of code:
find . -name "*.js" -type f | xargs wc -l | tail -1
Permissions — who can read, write, execute:
ls -la # See permissions: -rwxr-xr-x
chmod +x script.sh # Make a file executable
Process management — see what's running:
ps aux # All running processes
ps aux | grep node # Find Node processes
top # Live system monitor (q to quit)
Unix Philosophy — "Do one thing well."
grep finds text. sort sorts. uniq deduplicates. wc counts. Alone they're simple; piped together they become a data analysis pipeline.