DevOps Engineer Playbook: Practical Commands for Everyday Use

Linux is the foundation of DevOps operations – it’s like a Swiss Army knife for servers. These commands help you navigate systems, manage files, configure permissions, and automate tasks in terminal environments.

Basic Linux Commands
Command Usage
pwd Print the current working directory.
ls List files and directories.
cd Change directory.
touch Create an empty file.
mkdir Create a new directory.
rm Remove files or directories.
rmdir Remove empty directories.
cp Copy files or directories.
mv Move or rename files and directories.
cat Display the content of a file.
echo Display a line of text.
clear Clear the terminal screen.
Intermediate Linux Commands

Command Usage
chmod Change file permissions.
chown Change file ownership.
find Search for files and directories.
grep Search for text in a file.
wc Count lines, words, and characters in a file.
head Display the first few lines of a file.
tail Display the last few lines of a file.
sort Sort the contents of a file.
uniq Remove duplicate lines from a file.
diff Compare two files line by line.
tar Archive files into a tarball.
zip / unzip Compress and extract ZIP files.
df Display disk space usage.
du Display directory size.
top Monitor system processes in real time.
ps Display active processes.
kill Terminate a process by its PID.
ping Check network connectivity.
wget Download files from the internet.
curl Transfer data from or to a server.
scp Securely copy files between systems.
rsync Synchronize files and directories.
Advanced Linux Commands

Command Usage
awk Text processing and pattern scanning.
sed Stream editor for filtering and transforming text.
cut Remove sections from each line of a file.
tr Translate or delete characters.
xargs Build and execute command lines from standard input.
ln Create symbolic or hard links.
df -h Display disk usage in human-readable format.
free Display memory usage.
iostat Display CPU and I/O statistics.
netstat Network statistics (use ss as modern alternative).
ifconfig / ip Configure network interfaces (use ip as modern alternative).
iptables Configure firewall rules.
systemctl Control the systemd system and service manager.
journalctl View system logs.
crontab Schedule recurring tasks.
at Schedule tasks for a specific time.
uptime Display system uptime.
whoami Display the current user.
users List all users currently logged in.
hostname Display or set the system hostname.
env Display environment variables.
export Set environment variables.
Networking Commands

Command Usage
ip addr Display or configure IP addresses.
ip route Show or manipulate routing tables.
traceroute Trace the route packets take to a host.
nslookup Query DNS records.
dig Query DNS servers.
ssh Connect to a remote server via SSH.
ftp Transfer files using the FTP protocol.
nmap Network scanning and discovery.
telnet Communicate with remote hosts.
netcat (nc) Read/write data over networks.
File Management and Search Commands

Command Usage
locate Find files quickly using a database.
stat Display detailed information about a file.
tree Display directories as a tree.
file Determine a file’s type.
basename Extract the filename from a path.
dirname Extract the directory part of a path.
System Monitoring Commands

Command Usage
vmstat Display virtual memory statistics.
htop Interactive process viewer (alternative to top).
lsof List open files.
dmesg Print kernel ring buffer messages.
uptime Show how long the system has been running.
iotop Display real-time disk I/O by processes.
Package Management Commands

Command Usage
apt Package manager for Debian-based distributions.
yum / dnf Package manager for RHEL-based distributions.
snap Manage snap packages.
rpm Manage RPM packages.
Disk and Filesystem Commands

Command Usage
mount / umount Mount or unmount filesystems.
fsck Check and repair filesystems.
mkfs Create a new filesystem.
blkid Display information about block devices.
lsblk List information about block devices.
parted Manage partitions interactively.
Scripting and Automation Commands

Command Usage
bash Command interpreter and scripting shell.
sh Legacy shell interpreter.
cron Automate tasks.
alias Create shortcuts for commands.
source Execute commands from a file in the current shell.
Development and Debugging Commands

Command Usage
gcc Compile C programs.
make Build and manage projects.
strace Trace system calls and signals.
gdb Debug programs.
git Version control system.
vim / nano Text editors for scripting and editing.
Other Useful Commands

Command Usage
uptime Display system uptime.
date Display or set the system date and time.
cal Display a calendar.
man Display the manual for a command.
history Show previously executed commands.
alias Create custom shortcuts for commands.

Git is your code time machine. It tracks every change, enables team collaboration without conflicts, and lets you undo mistakes. These commands help manage source code versions like a professional developer.

Basic Git Commands

Command Usage Example
git init Initializes a new Git repository in the current directory. git init
git clone Copies a remote repository to the local machine. git clone https://github.com/user/repo.git
git status Displays the state of the working directory and staging area. git status
git add Adds changes to the staging area. git add file.txt
git commit Records changes to the repository. git commit -m “Initial commit”
git config Configures user settings, such as name and email. git config –global user.name “Your Name”
git log Shows the commit history. git log
git show Displays detailed information about a specific commit. git show <commit-hash>
git diff Shows changes between commits, the working directory, and the staging area. git diff
git reset Unstages changes or resets commits. git reset HEAD file.txt
Branching and Merging Commands

Command Usage Example
git branch Lists branches or creates a new branch. git branch feature-branch
git checkout Switches between branches or restores files. git checkout feature-branch
git switch Switches branches (modern alternative to git checkout). git switch feature-branch
git merge Combines changes from one branch into another. git merge feature-branch
git rebase Moves or combines commits from one branch onto another. git rebase main
git cherry-pick Applies specific commits from one branch to another. git cherry-pick <commit-hash>
Remote Repositories Commands

Command Usage Example
git remote Manages remote repository connections. git remote add origin https://github.com/user/repo.git
git push Sends changes to a remote repository. git push origin main
git pull Fetches and merges changes from a remote repository. git pull origin main
git fetch Downloads changes from a remote repository without merging. git fetch origin
git remote -v Lists the URLs of remote repositories. git remote -v
Stashing and Cleaning Commands

Command Usage Example
git stash Temporarily saves changes not yet committed. git stash
git stash pop Applies stashed changes and removes them from the stash list. git stash pop
git stash list Lists all stashes. git stash list
git clean Removes untracked files from the working directory. git clean -f
Tagging Commands

Command Usage Example
git tag Creates a tag for a specific commit. git tag -a v1.0 -m “Version 1.0”
git tag -d Deletes a tag. git tag -d v1.0
git push –tags Pushes tags to a remote repository. git push origin –tags
Advanced Commands

Command Usage Example
git bisect Finds the commit that introduced a bug. git bisect start
git blame Shows which commit and author modified each line of a file. git blame file.txt
git reflog Shows a log of changes to the tip of branches. git reflog
git submodule Manages external repositories as submodules. git submodule add https://github.com/user/repo.git
git archive Creates an archive of the repository files. git archive –format=zip HEAD > archive.zip
git gc Cleans up unnecessary files and optimizes the repository. git gc
GitHub-Specific Commands

Command Usage Example
gh auth login Logs into GitHub via the command line. gh auth login
gh repo clone Clones a GitHub repository. gh repo clone user/repo
gh issue list Lists issues in a GitHub repository. gh issue list
gh pr create Creates a pull request on GitHub. gh pr create –title “New Feature” –body “Description of the feature”
gh repo create Creates a new GitHub repository. gh repo create my-repo

Docker packages applications into portable containers – like shipping containers for software. These commands help build, ship, and run applications consistently across any environment.

Basic Docker Commands

Command Usage Example
docker –version Displays the installed Docker version. docker –version
docker info Shows system-wide information about Docker, such as the number of containers and images. docker info
docker pull Downloads an image from a Docker registry (default: Docker Hub). docker pull ubuntu:latest
docker images Lists all downloaded images. docker images
docker run Creates and starts a new container from an image. docker run -it ubuntu bash
docker ps Lists running containers. docker ps
docker ps -a Lists all containers, including stopped ones. docker ps -a
docker stop Stops a running container. docker stop container_name
docker start Starts a stopped container. docker start container_name
docker rm Removes a container. docker rm container_name
docker rmi Removes an image. docker rmi image_name
docker exec Runs a command inside a running container. docker exec -it container_name bash
Intermediate Docker Commands

Command Usage Example
docker build Builds an image from a Dockerfile. docker build -t my_image .
docker commit Creates a new image from a container’s changes. docker commit container_name my_image:tag
docker logs Fetches logs from a container. docker logs container_name
docker inspect Returns detailed information about an object (container or image). docker inspect container_name
docker stats Displays live resource usage statistics of running containers. docker stats
docker cp Copies files between a container and the host. docker cp container_name:/path/in/container /path/on/host
docker rename Renames a container. docker rename old_name new_name
docker network ls Lists all Docker networks. docker network ls
docker network create Creates a new Docker network. docker network create my_network
docker network inspect Shows details about a Docker network. docker network inspect my_network
docker network connect Connects a container to a network. docker network connect my_network container_name
docker volume ls Lists all Docker volumes. docker volume ls
docker volume create Creates a new Docker volume. docker volume create my_volume
docker volume inspect Provides details about a volume. docker volume inspect my_volume
docker volume rm Removes a Docker volume. docker volume rm my_volume
Advanced Docker Commands

Command Usage Example
docker-compose up Starts services defined in a docker-compose.yml file. docker-compose up
docker-compose down Stops and removes services defined in a docker-compose.yml file. docker-compose down
docker-compose logs Displays logs for services managed by Docker Compose. docker-compose logs
docker-compose exec Runs a command in a service’s container. docker-compose exec service_name bash
docker save Exports an image to a tar file. docker save -o my_image.tar my_image:tag
docker load Imports an image from a tar file. docker load < my_image.tar
docker export Exports a container’s filesystem as a tar file. docker export container_name > container.tar
docker import Creates an image from an exported container. docker import container.tar my_new_image
docker system df Displays disk usage by Docker objects. docker system df
docker system prune Cleans up unused Docker resources (images, containers, volumes, networks). docker system prune
docker tag Assigns a new tag to an image. docker tag old_image_name new_image_name
docker push Uploads an image to a Docker registry. docker push my_image:tag
docker login Logs into a Docker registry. docker login
docker logout Logs out of a Docker registry. docker logout
docker swarm init Initializes a Docker Swarm mode cluster. docker swarm init
docker service create Creates a new service in Swarm mode. docker service create –name my_service nginx
docker stack deploy Deploys a stack using a Compose file in Swarm mode. docker stack deploy -c docker-compose.yml my_stack
docker stack rm Removes a stack in Swarm mode. docker stack rm my_stack
docker checkpoint create Creates a checkpoint for a container. docker checkpoint create container_name checkpoint_name
docker checkpoint ls Lists checkpoints for a container. docker checkpoint ls container_name
docker checkpoint rm Removes a checkpoint. docker checkpoint rm container_name checkpoint_name

Kubernetes is the conductor of your container orchestra. It automates deployment, scaling, and management of containerized applications across server clusters.

Basic Kubernetes Commands

Command Usage Example
kubectl version Displays the Kubernetes client and server version. kubectl version –short
kubectl cluster-info Shows information about the Kubernetes cluster. kubectl cluster-info
kubectl get nodes Lists all nodes in the cluster. kubectl get nodes
kubectl get pods Lists all pods in the default namespace. kubectl get pods
kubectl get services Lists all services in the default namespace. kubectl get services
kubectl get namespaces Lists all namespaces in the cluster. kubectl get namespaces
kubectl describe pod Shows detailed information about a specific pod. kubectl describe pod pod-name
kubectl logs Displays logs for a specific pod. kubectl logs pod-name
kubectl create namespace Creates a new namespace. kubectl create namespace my-namespace
kubectl delete pod Deletes a specific pod. kubectl delete pod pod-name
Intermediate Kubernetes Commands

Command Usage Example
kubectl apply Applies changes defined in a YAML file. kubectl apply -f deployment.yaml
kubectl delete Deletes resources defined in a YAML file. kubectl delete -f deployment.yaml
kubectl scale Scales a deployment to the desired number of replicas. kubectl scale deployment my-deployment –replicas=3
kubectl expose Exposes a pod or deployment as a service. kubectl expose deployment my-deployment –type=LoadBalancer –port=80
kubectl exec Executes a command in a running pod. kubectl exec -it pod-name — /bin/bash
kubectl port-forward Forwards a local port to a port in a pod. kubectl port-forward pod-name 8080:80
kubectl get configmaps Lists all ConfigMaps in the namespace. kubectl get configmaps
kubectl get secrets Lists all Secrets in the namespace. kubectl get secrets
kubectl edit Edits a resource definition directly in the editor. kubectl edit deployment my-deployment
kubectl rollout status Displays the status of a deployment rollout. kubectl rollout status deployment/my-deployment
Advanced Kubernetes Commands

Command Usage Example
kubectl rollout undo Rolls back a deployment to a previous revision. kubectl rollout undo deployment/my-deployment
kubectl top nodes Shows resource usage for nodes. kubectl top nodes
kubectl top pods Displays resource usage for pods. kubectl top pods
kubectl cordon Marks a node as unschedulable. kubectl cordon node-name
kubectl uncordon Marks a node as schedulable. kubectl uncordon node-name
kubectl drain Safely evicts all pods from a node. kubectl drain node-name –ignore-daemonsets
kubectl taint Adds a taint to a node to control pod placement. kubectl taint nodes node-name key=value:NoSchedule
kubectl get events Lists all events in the cluster. kubectl get events
kubectl apply -k Applies resources from a kustomization directory. kubectl apply -k ./kustomization-dir/
kubectl config view Displays the kubeconfig file. kubectl config view
kubectl config use-context Switches the active context in kubeconfig. kubectl config use-context my-cluster
kubectl debug Creates a debugging session for a pod. kubectl debug pod-name
kubectl delete namespace Deletes a namespace and its resources. kubectl delete namespace my-namespace
kubectl patch Updates a resource using a patch. kubectl patch deployment my-deployment -p ‘{“spec”:{“replicas”:2}}’
kubectl rollout history Shows the rollout history of a deployment. kubectl rollout history deployment my-deployment
kubectl autoscale Automatically scales a deployment based on resource usage. kubectl autoscale deployment my-deployment –cpu-percent=50 –min=1 –max=10
kubectl label Adds or modifies a label on a resource. kubectl label pod pod-name environment=production
kubectl annotate Adds or modifies an annotation on a resource. kubectl annotate pod pod-name description=”My app pod”
kubectl delete pv Deletes a PersistentVolume (PV). kubectl delete pv my-pv
kubectl get ingress Lists all Ingress resources in the namespace. kubectl get ingress
kubectl create configmap Creates a ConfigMap from a file or literal values. kubectl create configmap my-config –from-literal=key1=value1
kubectl create secret Creates a Secret from a file or literal values. kubectl create secret generic my-secret –from-literal=password=myPassword
kubectl api-resources Lists all available API resources in the cluster. kubectl api-resources
kubectl api-versions Lists all API versions supported by the cluster. kubectl api-versions
kubectl get crds Lists all CustomResourceDefinitions (CRDs). kubectl get crds

Helm is the app store for Kubernetes. It simplifies installing and managing complex
applications using pre-packaged “charts” – think of it like apt-get for Kubernetes.

Basic Helm Commands
Command Usage Example
helm help Displays help for the Helm CLI or a specific command. helm help
helm version Shows the Helm client and server version. helm version
helm repo add Adds a new chart repository. helm repo add stable https://charts.helm.sh/stable
helm repo update Updates all Helm chart repositories to the latest version. helm repo update
helm repo list Lists all the repositories added to Helm. helm repo list
helm search hub Searches for charts on Helm Hub. helm search hub nginx
helm search repo Searches for charts in the repositories. helm search repo stable/nginx
helm show chart Displays information about a chart, including metadata and dependencies. helm show chart stable/nginx
Working with Helm Charts
Command Usage Example
helm install Installs a chart into a Kubernetes cluster. helm install my-release stable/nginx
helm upgrade Upgrades an existing release with a new version of the chart. helm upgrade my-release stable/nginx
helm upgrade –install Installs a chart if it isn’t installed or upgrades it if it exists. helm upgrade –install my-release stable/nginx
helm uninstall Uninstalls a release. helm uninstall my-release
helm list Lists all the releases installed on the Kubernetes cluster. helm list
helm status Displays the status of a release. helm status my-release
Advanced Helm Commands
Command Usage Example
helm rollback Rolls back a release to a previous version. helm rollback my-release 1
helm history Displays the history of a release. helm history my-release
helm get all Gets all information (including values and templates) for a release. helm get all my-release
helm get values Displays the values used in a release. helm get values my-release
helm test Runs tests defined in a chart. helm test my-release
Helm Chart Repositories
Command Usage Example
helm repo remove Removes a chart repository. helm repo remove stable
helm repo update Updates the local cache of chart repositories. helm repo update
helm repo index Creates or updates the index file for a chart repository. helm repo index ./charts
Helm Values and Customization
Command Usage Example
helm install –values Installs a chart with custom values. helm install my-release stable/nginx –values values.yaml
helm upgrade –values Upgrades a release with custom values. helm upgrade my-release stable/nginx –values values.yaml
helm install –set Installs a chart with a custom value set directly in the command. helm install my-release stable/nginx –set replicaCount=3
helm upgrade –set Upgrades a release with a custom value set. helm upgrade my-release stable/nginx –set replicaCount=5
helm uninstall –purge Removes a release and deletes associated resources, including the release history. helm uninstall my-release –purge
Helm Template and Debugging
Command Usage Example
helm template –debug Renders Kubernetes manifests and includes debug output. helm template my-release ./my-chart –debug
helm install –dry-run Simulates the installation process without actually installing. helm install my-release stable/nginx –dry-run
helm upgrade –dry-run Simulates an upgrade process without applying changes. helm upgrade my-release stable/nginx –dry-run
Helm and Kubernetes Integration
Command Usage Example
helm list –namespace Lists releases in a specific Kubernetes namespace. helm list –namespace kube-system
helm uninstall –namespace Uninstalls a release from a specific namespace. helm uninstall my-release –namespace kube-system
helm install –namespace Installs a chart into a specific namespace. helm install my-release stable/nginx –namespace mynamespace
helm upgrade –namespace Upgrades a release in a specific namespace. helm upgrade my-release stable/nginx –namespace mynamespace
Helm Chart Development
Command Usage Example
helm package –sign Packages a chart and signs it using a GPG key. helm package ./my-chart –sign –key my-key-id
helm create –starter Creates a new Helm chart based on a starter template. helm create –starter https://github.com/helm/charts.git
helm push Pushes a chart to a Helm chart repository. helm push ./my-chart my-repo
Helm with Kubernetes CLI
Command Usage Example
helm list -n Lists releases in a specific Kubernetes namespace. helm list -n kube-system
helm install –kube-context Installs a chart to a Kubernetes cluster defined in a specific kubeconfig context. helm install my-release stable/nginx –kube-context my-cluster
helm upgrade –kube-context Upgrades a release in a specific Kubernetes context. helm upgrade my-release stable/nginx –kube-context my-cluster
Helm Chart Dependencies
Command Usage Example
helm dependency build Builds dependencies for a Helm chart. helm dependency build ./my-chart
helm dependency list Lists all dependencies for a chart. helm dependency list ./my-chart
Helm History and Rollbacks
Command Usage Example
helm rollback –recreate-pods Rolls back to a previous version and recreates pods. helm rollback my-release 2 –recreate-pods
helm history –max Limits the number of versions shown in the release history. helm history my-release –max 5

Terraform lets you build cloud infrastructure with code. Instead of clicking buttons in AWS/GCP/Azure consoles, you define servers and services in configuration files.

Terraform Commands You Should Know

Command Usage
terraform –help Displays general help for Terraform CLI commands.
terraform init Initializes the working directory containing Terraform configuration files. It downloads the necessary provider plugins.
terraform validate Validates the Terraform configuration files for syntax errors or issues.
terraform plan Creates an execution plan, showing what actions Terraform will perform to make the infrastructure match the desired configuration.
terraform apply Applies the changes required to reach the desired state of the configuration. It will prompt for approval before making changes.
terraform show Displays the Terraform state or a plan in a human-readable format.
terraform output Displays the output values defined in the Terraform configuration after an apply.
terraform destroy Destroys the infrastructure defined in the Terraform configuration. It prompts for confirmation before destroying resources.
terraform refresh Updates the state file with the real infrastructure’s current state without applying changes.
terraform taint Marks a resource for recreation on the next apply. Useful for forcing a resource to be recreated even if it hasn’t been changed.
terraform untaint Removes the “tainted” status from a resource.
terraform state Manages Terraform state files, such as moving resources between modules or manually.
terraform import Imports existing infrastructure into Terraform management.
terraform graph Generates a graphical representation of Terraform’s resources and their relationships.
terraform providers Lists the providers available for the current Terraform configuration.
terraform state list Lists all resources tracked in the Terraform state file.
terraform backend Configures the backend for storing Terraform state remotely (e.g., in S3, Azure Blob Storage, etc.).
terraform state mv Moves an item in the state from one location to another.
terraform state rm Removes an item from the Terraform state file.
terraform workspace Manages Terraform workspaces, which allow for creating separate environments within a single configuration.
terraform workspace new Creates a new workspace.
terraform module Manages and updates Terraform modules, which are reusable configurations.
terraform init -get-plugins=true Ensures that required plugins are fetched and available for modules.
TF_LOG Sets the logging level for Terraform debug output (e.g., TRACE, DEBUG, INFO, WARN, ERROR).
TF_LOG_PATH Directs Terraform logs to a specified file.
terraform login Logs into Terraform Cloud or Terraform Enterprise for managing remote backends and workspaces.
terraform remote Manages remote backends and remote state storage for Terraform configurations.
terraform push Pushes Terraform modules to a remote module registry.

Devops Multi cloud Training

Choose the training style that fits your schedule — Self-Paced or Live Interactive Sessions. Both include hands-on projects, expert support, and lifetime access.

Feature Self-Paced Training Live Training
🎯 Mode 🎥Pre-Recorded Session 🧑‍🏫Live Class + Recordings
💼 Projects 🕒 Weekend Real-Time Projects 📅 Weekdays + Weekend Real-Time Projects
❓ Doubt Clearing 📞 Weekend Live Support Session 🧠 Anytime Doubt Clearing Session
👥 Career Support & Mentorship ❌ No ✅ Yes
🎓 Global Certification Training ❌ No ✅ Yes
🔑 Access ♾️ Lifetime Access ♾️ Lifetime Access
💰 Fees ₹4,999 (2 x ₹2,500) ₹7,999 (2 x ₹4,000)
ℹ️ For More Info Explore Self-Paced Training
Explore Live Training

Leave a Comment

Your email address will not be published. Required fields are marked *