Quick references for everyday developer tools. Copy-paste ready commands.
# Initialize repo
git init
# Clone repo
git clone <url>
git clone --depth 1 <url> # Shallow clone (faster)
# Status & info
git status
git log --oneline -n 10
git diff
git diff --staged
git add . # Stage all
git add -p # Stage interactively
git commit -m "message"
git commit --amend # Edit last commit
git commit --amend --no-edit # Keep message
git branch # List branches
git branch -a # List all (including remote)
git checkout -b <name> # Create & switch
git switch <name> # Switch branch
git merge <branch>
git rebase <branch>
git push origin <branch>
git push -u origin <branch> # Set upstream
git pull
git pull --rebase
git fetch origin
git restore <file> # Discard changes
git restore --staged <file> # Unstage
git reset HEAD~1 # Undo last commit (keep changes)
git reset --hard HEAD~1 # Destroy last commit
git stash
git stash pop
docker images # List images
docker pull <image>
docker build -t <name> .
docker build -t <name> -f Dockerfile.dev .
docker rmi <image>
docker image prune
docker ps # Running containers
docker ps -a # All containers
docker run -d -p 8080:80 <image> # Detach + port
docker run -it --rm <image> bash # Interactive + remove
docker exec -it <container> bash
docker logs -f <container> # Follow logs
docker stop <container>
docker rm <container>
docker rm -f <container> # Force remove
docker compose up -d
docker compose down
docker compose logs -f
docker compose restart
docker compose build
docker system prune -a # Remove all unused
docker system df # Disk usage
kubectl config get-contexts
kubectl config use-context <name>
kubectl cluster-info
kubectl get pods
kubectl get pods -A # All namespaces
kubectl get services
kubectl get deployments
kubectl get nodes
kubectl get ns # Namespaces
kubectl get all
kubectl describe pod <pod>
kubectl logs <pod>
kubectl logs -f <pod> # Follow
kubectl exec -it <pod> -- bash
kubectl top pods # Resource usage
kubectl top nodes
kubectl apply -f manifest.yaml
kubectl apply -k ./ # Kustomize
kubectl delete -f manifest.yaml
kubectl delete pod <pod>
kubectl expose deployment <name> --port=80 --type=LoadBalancer
kubectl scale deployment <name> --replicas=3
kubectl rollout restart deployment/<name>
# Identity (pretty print)
jq '.' file.json
# Get field
jq '.name' file.json
jq '.user.name' file.json
# Array index
jq '.[0]' file.json
jq '.[0].name' file.json
# Array length
jq '. | length' file.json
# All items in array
jq '.[]' file.json
# Map - extract field from array
jq '.[].name' file.json
jq '.[] | {name, email}' file.json
# Filter array
jq '.[] | select(.age > 30)' file.json
jq '.[] | select(.status == "active")' file.json
# Create new object
jq '{user: .name, email: .contact.email}' file.json
# Add/remove fields
jq '. + {timestamp: now}' file.json
jq 'del(.password)' file.json
jq -r '.name' file.json # Raw output (no quotes)
jq -c '.' file.json # Compact (one line)
jq -s '.' file1.json file2.json # Slurp multiple files
curl https://api.example.com
curl -I https://example.com # Headers only
curl -v https://example.com # Verbose
curl -X POST https://api.example.com/data
curl -X PUT https://api.example.com/data/1
curl -X DELETE https://api.example.com/data/1
curl -H "Content-Type: application/json" \
-H "Authorization: Bearer token" \
https://api.example.com
curl -X POST -d '{"name":"test"}' \
-H "Content-Type: application/json" \
https://api.example.com
curl -X POST --data @file.json https://api.example.com
curl -o output.json https://api.example.com
curl -O https://example.com/file.zip # Save with original name
curl -L https://example.com # Follow redirects
ls -la # List all (including hidden)
cp -r source dest # Copy recursive
mv old new # Move/rename
rm -rf dir # Remove recursive force
mkdir -p path/to/dir # Create parents too
touch file
chmod 755 file
chown user:group file
grep "pattern" file.txt
grep -r "pattern" . # Recursive
grep -i "pattern" file.txt # Case insensitive
find . -name "*.txt"
find . -type f -size +100M # Files > 100MB
ps aux # All processes
top # Interactive process viewer
htop # Better top (if installed)
kill -9 <pid> # Force kill
pkill -f process_name
df -h # Disk usage
free -h # Memory
uname -a # System info
whoami
pwd # Current directory
cat file.txt
head -20 file.txt
tail -f log.txt # Follow file
less file.txt
wc -l file.txt # Line count
sort file.txt
uniq file.txt
ifconfig / ip addr
netstat -tulpn # Listening ports
ss -tulpn # Modern netstat
ping example.com
curl ifconfig.me # Get public IP
ssh user@host
scp file.txt user@host:/path
man for full documentation--help flag on most commandsps aux | grep nginxCtrl+R in terminal~/.bashrc or ~/.zshrc共 1 个版本