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
CommandUsage
pwdPrint the current working directory.
lsList files and directories.
cdChange directory.
touchCreate an empty file.
mkdirCreate a new directory.
rmRemove files or directories.
rmdirRemove empty directories.
cpCopy files or directories.
mvMove or rename files and directories.
catDisplay the content of a file.
echoDisplay a line of text.
clearClear the terminal screen.
Intermediate Linux Commands

CommandUsage
chmodChange file permissions.
chownChange file ownership.
findSearch for files and directories.
grepSearch for text in a file.
wcCount lines, words, and characters in a file.
headDisplay the first few lines of a file.
tailDisplay the last few lines of a file.
sortSort the contents of a file.
uniqRemove duplicate lines from a file.
diffCompare two files line by line.
tarArchive files into a tarball.
zip / unzipCompress and extract ZIP files.
dfDisplay disk space usage.
duDisplay directory size.
topMonitor system processes in real time.
psDisplay active processes.
killTerminate a process by its PID.
pingCheck network connectivity.
wgetDownload files from the internet.
curlTransfer data from or to a server.
scpSecurely copy files between systems.
rsyncSynchronize files and directories.
Advanced Linux Commands

CommandUsage
awkText processing and pattern scanning.
sedStream editor for filtering and transforming text.
cutRemove sections from each line of a file.
trTranslate or delete characters.
xargsBuild and execute command lines from standard input.
lnCreate symbolic or hard links.
df -hDisplay disk usage in human-readable format.
freeDisplay memory usage.
iostatDisplay CPU and I/O statistics.
netstatNetwork statistics (use ss as modern alternative).
ifconfig / ipConfigure network interfaces (use ip as modern alternative).
iptablesConfigure firewall rules.
systemctlControl the systemd system and service manager.
journalctlView system logs.
crontabSchedule recurring tasks.
atSchedule tasks for a specific time.
uptimeDisplay system uptime.
whoamiDisplay the current user.
usersList all users currently logged in.
hostnameDisplay or set the system hostname.
envDisplay environment variables.
exportSet environment variables.
Networking Commands

CommandUsage
ip addrDisplay or configure IP addresses.
ip routeShow or manipulate routing tables.
tracerouteTrace the route packets take to a host.
nslookupQuery DNS records.
digQuery DNS servers.
sshConnect to a remote server via SSH.
ftpTransfer files using the FTP protocol.
nmapNetwork scanning and discovery.
telnetCommunicate with remote hosts.
netcat (nc)Read/write data over networks.
File Management and Search Commands

CommandUsage
locateFind files quickly using a database.
statDisplay detailed information about a file.
treeDisplay directories as a tree.
fileDetermine a fileโ€™s type.
basenameExtract the filename from a path.
dirnameExtract the directory part of a path.
System Monitoring Commands

CommandUsage
vmstatDisplay virtual memory statistics.
htopInteractive process viewer (alternative to top).
lsofList open files.
dmesgPrint kernel ring buffer messages.
uptimeShow how long the system has been running.
iotopDisplay real-time disk I/O by processes.
Package Management Commands

CommandUsage
aptPackage manager for Debian-based distributions.
yum / dnfPackage manager for RHEL-based distributions.
snapManage snap packages.
rpmManage RPM packages.
Disk and Filesystem Commands

CommandUsage
mount / umountMount or unmount filesystems.
fsckCheck and repair filesystems.
mkfsCreate a new filesystem.
blkidDisplay information about block devices.
lsblkList information about block devices.
partedManage partitions interactively.
Scripting and Automation Commands

CommandUsage
bashCommand interpreter and scripting shell.
shLegacy shell interpreter.
cronAutomate tasks.
aliasCreate shortcuts for commands.
sourceExecute commands from a file in the current shell.
Development and Debugging Commands

CommandUsage
gccCompile C programs.
makeBuild and manage projects.
straceTrace system calls and signals.
gdbDebug programs.
gitVersion control system.
vim / nanoText editors for scripting and editing.
Other Useful Commands

CommandUsage
uptimeDisplay system uptime.
dateDisplay or set the system date and time.
calDisplay a calendar.
manDisplay the manual for a command.
historyShow previously executed commands.
aliasCreate 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

CommandUsageExample
git initInitializes a new Git repository in the current directory.git init
git cloneCopies a remote repository to the local machine.git clone https://github.com/user/repo.git
git statusDisplays the state of the working directory and staging area.git status
git addAdds changes to the staging area.git add file.txt
git commitRecords changes to the repository.git commit -m “Initial commit”
git configConfigures user settings, such as name and email.git config –global user.name “Your Name”
git logShows the commit history.git log
git showDisplays detailed information about a specific commit.git show <commit-hash>
git diffShows changes between commits, the working directory, and the staging area.git diff
git resetUnstages changes or resets commits.git reset HEAD file.txt
Branching and Merging Commands

CommandUsageExample
git branchLists branches or creates a new branch.git branch feature-branch
git checkoutSwitches between branches or restores files.git checkout feature-branch
git switchSwitches branches (modern alternative to git checkout).git switch feature-branch
git mergeCombines changes from one branch into another.git merge feature-branch
git rebaseMoves or combines commits from one branch onto another.git rebase main
git cherry-pickApplies specific commits from one branch to another.git cherry-pick <commit-hash>
Remote Repositories Commands

CommandUsageExample
git remoteManages remote repository connections.git remote add origin https://github.com/user/repo.git
git pushSends changes to a remote repository.git push origin main
git pullFetches and merges changes from a remote repository.git pull origin main
git fetchDownloads changes from a remote repository without merging.git fetch origin
git remote -vLists the URLs of remote repositories.git remote -v
Stashing and Cleaning Commands

CommandUsageExample
git stashTemporarily saves changes not yet committed.git stash
git stash popApplies stashed changes and removes them from the stash list.git stash pop
git stash listLists all stashes.git stash list
git cleanRemoves untracked files from the working directory.git clean -f
Tagging Commands

CommandUsageExample
git tagCreates a tag for a specific commit.git tag -a v1.0 -m “Version 1.0”
git tag -dDeletes a tag.git tag -d v1.0
git push –tagsPushes tags to a remote repository.git push origin –tags
Advanced Commands

CommandUsageExample
git bisectFinds the commit that introduced a bug.git bisect start
git blameShows which commit and author modified each line of a file.git blame file.txt
git reflogShows a log of changes to the tip of branches.git reflog
git submoduleManages external repositories as submodules.git submodule add https://github.com/user/repo.git
git archiveCreates an archive of the repository files.git archive –format=zip HEAD > archive.zip
git gcCleans up unnecessary files and optimizes the repository.git gc
GitHub-Specific Commands

CommandUsageExample
gh auth loginLogs into GitHub via the command line.gh auth login
gh repo cloneClones a GitHub repository.gh repo clone user/repo
gh issue listLists issues in a GitHub repository.gh issue list
gh pr createCreates a pull request on GitHub.gh pr create –title “New Feature” –body “Description of the feature”
gh repo createCreates 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

CommandUsageExample
docker –versionDisplays the installed Docker version.docker –version
docker infoShows system-wide information about Docker, such as the number of containers and images.docker info
docker pullDownloads an image from a Docker registry (default: Docker Hub).docker pull ubuntu:latest
docker imagesLists all downloaded images.docker images
docker runCreates and starts a new container from an image.docker run -it ubuntu bash
docker psLists running containers.docker ps
docker ps -aLists all containers, including stopped ones.docker ps -a
docker stopStops a running container.docker stop container_name
docker startStarts a stopped container.docker start container_name
docker rmRemoves a container.docker rm container_name
docker rmiRemoves an image.docker rmi image_name
docker execRuns a command inside a running container.docker exec -it container_name bash
Intermediate Docker Commands

CommandUsageExample
docker buildBuilds an image from a Dockerfile.docker build -t my_image .
docker commitCreates a new image from a containerโ€™s changes.docker commit container_name my_image:tag
docker logsFetches logs from a container.docker logs container_name
docker inspectReturns detailed information about an object (container or image).docker inspect container_name
docker statsDisplays live resource usage statistics of running containers.docker stats
docker cpCopies files between a container and the host.docker cp container_name:/path/in/container /path/on/host
docker renameRenames a container.docker rename old_name new_name
docker network lsLists all Docker networks.docker network ls
docker network createCreates a new Docker network.docker network create my_network
docker network inspectShows details about a Docker network.docker network inspect my_network
docker network connectConnects a container to a network.docker network connect my_network container_name
docker volume lsLists all Docker volumes.docker volume ls
docker volume createCreates a new Docker volume.docker volume create my_volume
docker volume inspectProvides details about a volume.docker volume inspect my_volume
docker volume rmRemoves a Docker volume.docker volume rm my_volume
Advanced Docker Commands

CommandUsageExample
docker-compose upStarts services defined in a docker-compose.yml file.docker-compose up
docker-compose downStops and removes services defined in a docker-compose.yml file.docker-compose down
docker-compose logsDisplays logs for services managed by Docker Compose.docker-compose logs
docker-compose execRuns a command in a serviceโ€™s container.docker-compose exec service_name bash
docker saveExports an image to a tar file.docker save -o my_image.tar my_image:tag
docker loadImports an image from a tar file.docker load < my_image.tar
docker exportExports a containerโ€™s filesystem as a tar file.docker export container_name > container.tar
docker importCreates an image from an exported container.docker import container.tar my_new_image
docker system dfDisplays disk usage by Docker objects.docker system df
docker system pruneCleans up unused Docker resources (images, containers, volumes, networks).docker system prune
docker tagAssigns a new tag to an image.docker tag old_image_name new_image_name
docker pushUploads an image to a Docker registry.docker push my_image:tag
docker loginLogs into a Docker registry.docker login
docker logoutLogs out of a Docker registry.docker logout
docker swarm initInitializes a Docker Swarm mode cluster.docker swarm init
docker service createCreates a new service in Swarm mode.docker service create –name my_service nginx
docker stack deployDeploys a stack using a Compose file in Swarm mode.docker stack deploy -c docker-compose.yml my_stack
docker stack rmRemoves a stack in Swarm mode.docker stack rm my_stack
docker checkpoint createCreates a checkpoint for a container.docker checkpoint create container_name checkpoint_name
docker checkpoint lsLists checkpoints for a container.docker checkpoint ls container_name
docker checkpoint rmRemoves 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

CommandUsageExample
kubectl versionDisplays the Kubernetes client and server version.kubectl version –short
kubectl cluster-infoShows information about the Kubernetes cluster.kubectl cluster-info
kubectl get nodesLists all nodes in the cluster.kubectl get nodes
kubectl get podsLists all pods in the default namespace.kubectl get pods
kubectl get servicesLists all services in the default namespace.kubectl get services
kubectl get namespacesLists all namespaces in the cluster.kubectl get namespaces
kubectl describe podShows detailed information about a specific pod.kubectl describe pod pod-name
kubectl logsDisplays logs for a specific pod.kubectl logs pod-name
kubectl create namespaceCreates a new namespace.kubectl create namespace my-namespace
kubectl delete podDeletes a specific pod.kubectl delete pod pod-name
Intermediate Kubernetes Commands

CommandUsageExample
kubectl applyApplies changes defined in a YAML file.kubectl apply -f deployment.yaml
kubectl deleteDeletes resources defined in a YAML file.kubectl delete -f deployment.yaml
kubectl scaleScales a deployment to the desired number of replicas.kubectl scale deployment my-deployment –replicas=3
kubectl exposeExposes a pod or deployment as a service.kubectl expose deployment my-deployment –type=LoadBalancer –port=80
kubectl execExecutes a command in a running pod.kubectl exec -it pod-name — /bin/bash
kubectl port-forwardForwards a local port to a port in a pod.kubectl port-forward pod-name 8080:80
kubectl get configmapsLists all ConfigMaps in the namespace.kubectl get configmaps
kubectl get secretsLists all Secrets in the namespace.kubectl get secrets
kubectl editEdits a resource definition directly in the editor.kubectl edit deployment my-deployment
kubectl rollout statusDisplays the status of a deployment rollout.kubectl rollout status deployment/my-deployment
Advanced Kubernetes Commands

CommandUsageExample
kubectl rollout undoRolls back a deployment to a previous revision.kubectl rollout undo deployment/my-deployment
kubectl top nodesShows resource usage for nodes.kubectl top nodes
kubectl top podsDisplays resource usage for pods.kubectl top pods
kubectl cordonMarks a node as unschedulable.kubectl cordon node-name
kubectl uncordonMarks a node as schedulable.kubectl uncordon node-name
kubectl drainSafely evicts all pods from a node.kubectl drain node-name –ignore-daemonsets
kubectl taintAdds a taint to a node to control pod placement.kubectl taint nodes node-name key=value:NoSchedule
kubectl get eventsLists all events in the cluster.kubectl get events
kubectl apply -kApplies resources from a kustomization directory.kubectl apply -k ./kustomization-dir/
kubectl config viewDisplays the kubeconfig file.kubectl config view
kubectl config use-contextSwitches the active context in kubeconfig.kubectl config use-context my-cluster
kubectl debugCreates a debugging session for a pod.kubectl debug pod-name
kubectl delete namespaceDeletes a namespace and its resources.kubectl delete namespace my-namespace
kubectl patchUpdates a resource using a patch.kubectl patch deployment my-deployment -p ‘{“spec”:{“replicas”:2}}’
kubectl rollout historyShows the rollout history of a deployment.kubectl rollout history deployment my-deployment
kubectl autoscaleAutomatically scales a deployment based on resource usage.kubectl autoscale deployment my-deployment –cpu-percent=50 –min=1 –max=10
kubectl labelAdds or modifies a label on a resource.kubectl label pod pod-name environment=production
kubectl annotateAdds or modifies an annotation on a resource.kubectl annotate pod pod-name description=”My app pod”
kubectl delete pvDeletes a PersistentVolume (PV).kubectl delete pv my-pv
kubectl get ingressLists all Ingress resources in the namespace.kubectl get ingress
kubectl create configmapCreates a ConfigMap from a file or literal values.kubectl create configmap my-config –from-literal=key1=value1
kubectl create secretCreates a Secret from a file or literal values.kubectl create secret generic my-secret –from-literal=password=myPassword
kubectl api-resourcesLists all available API resources in the cluster.kubectl api-resources
kubectl api-versionsLists all API versions supported by the cluster.kubectl api-versions
kubectl get crdsLists 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
CommandUsageExample
helm helpDisplays help for the Helm CLI or a specific command.helm help
helm versionShows the Helm client and server version.helm version
helm repo addAdds a new chart repository.helm repo add stable https://charts.helm.sh/stable
helm repo updateUpdates all Helm chart repositories to the latest version.helm repo update
helm repo listLists all the repositories added to Helm.helm repo list
helm search hubSearches for charts on Helm Hub.helm search hub nginx
helm search repoSearches for charts in the repositories.helm search repo stable/nginx
helm show chartDisplays information about a chart, including metadata and dependencies.helm show chart stable/nginx
Working with Helm Charts
CommandUsageExample
helm installInstalls a chart into a Kubernetes cluster.helm install my-release stable/nginx
helm upgradeUpgrades an existing release with a new version of the chart.helm upgrade my-release stable/nginx
helm upgrade –installInstalls a chart if it isnโ€™t installed or upgrades it if it exists.helm upgrade –install my-release stable/nginx
helm uninstallUninstalls a release.helm uninstall my-release
helm listLists all the releases installed on the Kubernetes cluster.helm list
helm statusDisplays the status of a release.helm status my-release
Advanced Helm Commands
CommandUsageExample
helm rollbackRolls back a release to a previous version.helm rollback my-release 1
helm historyDisplays the history of a release.helm history my-release
helm get allGets all information (including values and templates) for a release.helm get all my-release
helm get valuesDisplays the values used in a release.helm get values my-release
helm testRuns tests defined in a chart.helm test my-release
Helm Chart Repositories
CommandUsageExample
helm repo removeRemoves a chart repository.helm repo remove stable
helm repo updateUpdates the local cache of chart repositories.helm repo update
helm repo indexCreates or updates the index file for a chart repository.helm repo index ./charts
Helm Values and Customization
CommandUsageExample
helm install –valuesInstalls a chart with custom values.helm install my-release stable/nginx –values values.yaml
helm upgrade –valuesUpgrades a release with custom values.helm upgrade my-release stable/nginx –values values.yaml
helm install –setInstalls a chart with a custom value set directly in the command.helm install my-release stable/nginx –set replicaCount=3
helm upgrade –setUpgrades a release with a custom value set.helm upgrade my-release stable/nginx –set replicaCount=5
helm uninstall –purgeRemoves a release and deletes associated resources, including the release history.helm uninstall my-release –purge
Helm Template and Debugging
CommandUsageExample
helm template –debugRenders Kubernetes manifests and includes debug output.helm template my-release ./my-chart –debug
helm install –dry-runSimulates the installation process without actually installing.helm install my-release stable/nginx –dry-run
helm upgrade –dry-runSimulates an upgrade process without applying changes.helm upgrade my-release stable/nginx –dry-run
Helm and Kubernetes Integration
CommandUsageExample
helm list –namespaceLists releases in a specific Kubernetes namespace.helm list –namespace kube-system
helm uninstall –namespaceUninstalls a release from a specific namespace.helm uninstall my-release –namespace kube-system
helm install –namespaceInstalls a chart into a specific namespace.helm install my-release stable/nginx –namespace mynamespace
helm upgrade –namespaceUpgrades a release in a specific namespace.helm upgrade my-release stable/nginx –namespace mynamespace
Helm Chart Development
CommandUsageExample
helm package –signPackages a chart and signs it using a GPG key.helm package ./my-chart –sign –key my-key-id
helm create –starterCreates a new Helm chart based on a starter template.helm create –starter https://github.com/helm/charts.git
helm pushPushes a chart to a Helm chart repository.helm push ./my-chart my-repo
Helm with Kubernetes CLI
CommandUsageExample
helm list -nLists releases in a specific Kubernetes namespace.helm list -n kube-system
helm install –kube-contextInstalls 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-contextUpgrades a release in a specific Kubernetes context.helm upgrade my-release stable/nginx –kube-context my-cluster
Helm Chart Dependencies
CommandUsageExample
helm dependency buildBuilds dependencies for a Helm chart.helm dependency build ./my-chart
helm dependency listLists all dependencies for a chart.helm dependency list ./my-chart
Helm History and Rollbacks
CommandUsageExample
helm rollback –recreate-podsRolls back to a previous version and recreates pods.helm rollback my-release 2 –recreate-pods
helm history –maxLimits 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

CommandUsage
terraform –helpDisplays general help for Terraform CLI commands.
terraform initInitializes the working directory containing Terraform configuration files. It downloads the necessary provider plugins.
terraform validateValidates the Terraform configuration files for syntax errors or issues.
terraform planCreates an execution plan, showing what actions Terraform will perform to make the infrastructure match the desired configuration.
terraform applyApplies the changes required to reach the desired state of the configuration. It will prompt for approval before making changes.
terraform showDisplays the Terraform state or a plan in a human-readable format.
terraform outputDisplays the output values defined in the Terraform configuration after an apply.
terraform destroyDestroys the infrastructure defined in the Terraform configuration. It prompts for confirmation before destroying resources.
terraform refreshUpdates the state file with the real infrastructure’s current state without applying changes.
terraform taintMarks a resource for recreation on the next apply. Useful for forcing a resource to be recreated even if it hasn’t been changed.
terraform untaintRemoves the “tainted” status from a resource.
terraform stateManages Terraform state files, such as moving resources between modules or manually.
terraform importImports existing infrastructure into Terraform management.
terraform graphGenerates a graphical representation of Terraform’s resources and their relationships.
terraform providersLists the providers available for the current Terraform configuration.
terraform state listLists all resources tracked in the Terraform state file.
terraform backendConfigures the backend for storing Terraform state remotely (e.g., in S3, Azure Blob Storage, etc.).
terraform state mvMoves an item in the state from one location to another.
terraform state rmRemoves an item from the Terraform state file.
terraform workspaceManages Terraform workspaces, which allow for creating separate environments within a single configuration.
terraform workspace newCreates a new workspace.
terraform moduleManages and updates Terraform modules, which are reusable configurations.
terraform init -get-plugins=trueEnsures that required plugins are fetched and available for modules.
TF_LOGSets the logging level for Terraform debug output (e.g., TRACE, DEBUG, INFO, WARN, ERROR).
TF_LOG_PATHDirects Terraform logs to a specified file.
terraform loginLogs into Terraform Cloud or Terraform Enterprise for managing remote backends and workspaces.
terraform remoteManages remote backends and remote state storage for Terraform configurations.
terraform pushPushes 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.

FeatureSelf-Paced TrainingLive 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 InfoExplore Self-Paced Training Explore Live Training

Leave a Comment

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

Open chat
Hello, Good day!!
How can we help you?