Tech News, Tech & Coding · Free Online Tools

IT Question Answer
Tools
Back to Top Lists
Top 10 DevOps Cheat Sheet

Top 10 DevOps Cheat Sheet

Top ListsBy Muhammad Fareed
cheatsheetdevopscheatsheet

Short answer: this sheet collects the commands DevOps engineers use every day across Docker, Kubernetes, Terraform, Git, Linux and CI/CD. Try them on a test environment first, and double-check anything that deletes or applies changes.

1. Docker

CommandPurpose
docker build -t app:1.0 .Build an image from a Dockerfile
docker run -d -p 8080:80 --name web app:1.0Run a container in the background, mapping a port
docker ps / docker ps -aList running / all containers
docker logs -f webFollow container logs
docker exec -it web shOpen a shell inside a container
docker stop web && docker rm webStop and remove a container
docker compose up -dStart all services from a compose file
docker system pruneRemove unused data (read the prompt before confirming)

Background: Docker containers complete guide.

2. Kubernetes (kubectl)

CommandPurpose
kubectl get pods -AList pods in all namespaces
kubectl describe pod NAMEShow details and recent events
kubectl logs -f NAMEStream pod logs
kubectl apply -f deploy.yamlCreate or update resources from a file
kubectl rollout status deploy/NAMEWatch a rollout
kubectl rollout undo deploy/NAMERoll back to the previous version
kubectl scale deploy/NAME --replicas=3Change the number of pods
kubectl config get-contextsSee which cluster you are connected to

Always confirm your current context before applying changes. See Kubernetes basics.

3. Terraform

terraform init       # download providers
terraform fmt        # format files
terraform validate   # check syntax
terraform plan       # preview changes
terraform apply      # create or change infrastructure
terraform destroy    # remove managed resources (use with great care)

Learn more in Infrastructure as Code with Terraform.

4. Git

git status
git switch -c feature/login        # new branch
git add -p                          # stage selectively
git commit -m "Add login form"
git pull --rebase origin main
git push -u origin feature/login
git log --oneline --graph --decorate

More in the Git commands cheat sheet.

5. Linux essentials

CommandPurpose
ls -lahList files with sizes and hidden files
grep -rn "error" /var/log/appSearch text recursively with line numbers
tail -f /var/log/syslogFollow a log file
top / htopWatch processes and CPU/memory use
df -h / du -sh *Check disk space
ss -tulpnSee listening ports
chmod 640 file / chown user:group fileChange permissions and ownership
systemctl status nginxCheck a service
journalctl -u nginx -fFollow a service's logs

6. Networking and debugging

curl -I https://example.com        # response headers
curl -v http://localhost:3000/health
ping -c 4 example.com
dig example.com +short             # DNS lookup
nc -zv host 443                    # test a port

7. SSH

ssh-keygen -t ed25519 -C "you@example.com"
ssh user@host
scp file.txt user@host:/tmp/
ssh -L 5432:localhost:5432 user@host   # port forwarding tunnel

8. CI/CD concepts and a minimal pipeline

name: ci
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 20 }
      - run: npm ci
      - run: npm test

Read CI/CD pipelines explained and GitHub Actions CI/CD.

9. Cloud CLI basics (AWS example)

aws sts get-caller-identity          # who am I?
aws s3 ls
aws s3 sync ./build s3://my-bucket
aws ec2 describe-instances --query "Reservations[].Instances[].InstanceId"

10. Safety habits

  • Check the active cluster, account and branch before running commands that change things.
  • Use plan, --dry-run or diff options before applying.
  • Never paste secrets into terminals or logs; use a secrets manager.
  • Keep infrastructure and pipelines in version control.

Next steps

Understand the practice itself in what DevOps is.