One-Liners

Commands that don’t fit a single category but are too good to forget.

File Operations

# Find files modified in last 24h
find . -type f -mtime -1

# Find and delete empty directories
find . -type d -empty -delete

# Disk usage sorted by size
du -sh */ | sort -h

Network

# Quick port check
nc -zv host 443

# All listening ports with process
ss -tlnp

# DNS lookup with specific server
dig +short hostname @10.50.1.1

Kubernetes

# All pods not Running
kubectl get pods -A | awk '$4 != "Running" && NR>1'

# Decode secret
kubectl get secret NAME -o jsonpath='{.data.password}' | base64 -d

# Watch pod logs
kubectl logs -f pod-name --tail=100

Git

# Files changed in last commit
git diff --name-only HEAD~1

# Search commit messages
git log --grep="pattern" --oneline

# Undo last commit (keep changes)
git reset --soft HEAD~1

JSON/YAML

# Pretty print JSON
cat file.json | jq .

# Extract nested value
jq -r '.data.certificate' file.json

# YAML to JSON
yq -o=json file.yaml