File Operations
| Command | Description |
ls -la | List all files with details |
cd /path | Change directory |
mkdir -p dir/subdir | Create nested directories |
cp -r src dest | Copy recursively |
mv old new | Move/rename |
rm -rf dir | Remove recursively (careful!) |
find . -name "*.js" | Find files by name |
du -sh * | Directory sizes |
df -h | Disk space usage |
Text Processing
| Command | Description |
cat file | Print file contents |
head -20 file | First 20 lines |
tail -f log | Follow log file |
grep -r "pattern" . | Search recursively |
sed 's/old/new/g' file | Find and replace |
awk '{print $1}' file | Print first column |
sort file | uniq -c | Count unique lines |
wc -l file | Count lines |
Process Management
| Command | Description |
ps aux | List all processes |
top / htop | Interactive process viewer |
kill <pid> | Send SIGTERM |
kill -9 <pid> | Force kill |
nohup cmd & | Run in background (survives logout) |
jobs / fg / bg | Job control |
Networking
| Command | Description |
curl -s url | HTTP request |
wget url | Download file |
ss -tulpn | Show listening ports |
ping host | Check connectivity |
dig domain | DNS lookup |
Pipes & Redirection
# Pipe output to another command
cat file | grep "error" | wc -l
# Redirect stdout to file
command > output.txt
# Append to file
command >> output.txt
# Redirect stderr
command 2> errors.txt
# Redirect both
command > output.txt 2>&1