15 DevOps Commands Freshers Must Learn
15 DevOps commands for freshers with real flags and examples: ssh, grep, systemctl, journalctl, ss, curl, git, docker, kubectl, terraform and ansible.
The 15 commands a DevOps fresher should learn first are ssh, grep, chmod, ps, df, systemctl, journalctl, ss, curl, git, docker, kubectl, terraform, ansible and tail. Together they cover reaching a server, reading logs, checking services, ports and disk, testing endpoints, and driving version control, containers, Kubernetes and infrastructure as code.
Each command below comes with the flags you will use most, a realistic example and the question it answers during troubleshooting. The options were checked against the official manual pages and tool documentation in November 2026. If you are new to the field, read what DevOps is first; this guide assumes you know the basic idea and want to get comfortable in a terminal.
Key takeaways
- Learn the Linux commands first. Most container and cloud problems end up as a process, a port, a file permission, a disk or a log question.
- For every command, learn three or four flags well rather than every option.
- Read output carefully before typing the next command. Troubleshooting is mostly a sequence of small questions.
- Practise on a throwaway VM or cloud instance, never on a shared server.
- Use
manand--helpconstantly; nobody remembers every flag.
The 15 commands at a glance
| # | Command | Question it answers |
|---|---|---|
| 1 | ssh | How do I get onto that server? |
| 2 | grep | Where is this error or setting? |
| 3 | tail | What is the log saying right now? |
| 4 | chmod | Why is this file not readable or executable? |
| 5 | ps | Is the process running, and as which user? |
| 6 | df | Is the disk full? |
| 7 | systemctl | Is the service running, and does it start on boot? |
| 8 | journalctl | Why did the service fail? |
| 9 | ss | Is anything listening on that port? |
| 10 | curl | Does the endpoint respond, and with what? |
| 11 | git | What changed, and who changed it? |
| 12 | docker | Is the container running, and what is it logging? |
| 13 | kubectl | Why is this Pod not healthy? |
| 14 | terraform | What will this infrastructure change do? |
| 15 | ansible | Can I run the same check on many servers at once? |
Linux basics
1. ssh
Almost every task on a server starts with ssh. Learn to log in with a key instead of a password, to pick a key with -i, to use a non-default port with -p, and to run one command remotely without opening a shell.
ssh -i ~/.ssh/lab-key.pem [email protected]
ssh -p 2222 deploy@app01 'uptime'
Generate your own key pair with ssh-keygen, and keep host aliases in ~/.ssh/config so you type ssh app01 instead of a long line. Never share a private key or paste it into chat tools.
2. grep
grep searches text. You will use it on logs, configuration files and command output every day. The flags worth learning first are -i for case-insensitive matching, -r to search a directory, -n to show line numbers, -v to invert the match and -E for extended regular expressions.
grep -rn "listen" /etc/nginx/
grep -iE "error|timeout" /var/log/app/app.log
ps aux | grep -v grep | grep nginx
Piping other commands into grep is one of the most useful habits a fresher can build.
3. tail
tail prints the end of a file. tail -n 100 shows the last 100 lines, and tail -f keeps printing new lines as they are written, which is how you watch a log while you reproduce a problem in another window.
tail -n 100 /var/log/nginx/error.log
tail -f /var/log/app/app.log | grep -i error
Use less when you need to scroll and search inside a large file, and head when you only want the beginning.
4. chmod
Permission errors are among the most common problems freshers hit, especially with scripts that will not run and SSH keys that are rejected. chmod changes the read, write and execute bits for the owner, the group and everyone else. Pair it with ls -l to see the current permissions and chown to change the owner.
ls -l deploy.sh
chmod +x deploy.sh
chmod 600 ~/.ssh/lab-key.pem
sudo chown -R www-data:www-data /var/www/app
SSH refuses private keys that other users can read, which is why chmod 600 on a key file fixes a confusing login failure. For a deeper look at the related commands, read the difference between chmod, chown and chgrp.
5. ps
ps aux lists every process with its user, CPU and memory use and full command line. Use it to confirm that a process is running and under which account. top, or htop if it is installed, gives a live view sorted by CPU or memory.
ps aux | grep java
ps -ef --forest | less
top
If an application "is running" according to a teammate but nothing answers on its port, ps is how you check the first half of that claim.
6. df
A full disk causes failed deployments, crashed databases and logs that stop being written. df -h shows free space per filesystem in human-readable units. When a filesystem is full, du finds which directories are using the space.
df -h
sudo du -sh /var/log/* | sort -h | tail
Docker images and old logs are frequent culprits on build servers. Our article on monitoring disk usage with df, du and smartctl goes further.
Services, ports and endpoints
7. systemctl
On most current Linux distributions, services are managed by systemd through systemctl. Learn status, start, stop, restart, enable and is-enabled.
systemctl status nginx
sudo systemctl restart nginx
sudo systemctl enable --now nginx
systemctl list-units --type=service --state=failed
enable --now starts the service and makes it start at boot in one step. The last command lists every service that failed, which is a quick health check on a new server.
8. journalctl
When systemctl status says a service failed, journalctl tells you why. -u selects a unit, -f follows new entries, --since limits the time range, -p err shows errors and anything more severe, and -b limits output to the current boot.
journalctl -u nginx --since "1 hour ago"
journalctl -u myapp -f
journalctl -p err -b
The -xe combination you will see in many error messages adds explanatory catalog text and jumps to the end of the journal.
9. ss
ss shows sockets. ss -tlnp lists TCP sockets that are listening, with numeric ports and the process that owns each one. It answers "is my application actually listening, and on which address?"
sudo ss -tlnp
sudo ss -tlnp | grep :8080
A service listening on 127.0.0.1:8080 is reachable only from the same machine. If it should be reachable from outside, it must listen on 0.0.0.0 or the server's address, and the firewall must allow the port.
10. curl
curl makes HTTP requests from the terminal. Use it to test an API, a health endpoint or a load balancer without a browser. -I fetches only the headers, -L follows redirects, -v shows the full request and response including TLS details, and -o saves the body to a file.
curl -I https://example.com
curl -v http://localhost:8080/health
curl -L -o app.tar.gz https://example.com/releases/app.tar.gz
Testing from the server itself with localhost and then from another machine is a quick way to tell an application problem from a network or firewall problem.
Version control
11. git
Everything in DevOps lives in Git: application code, pipeline definitions, infrastructure code and Kubernetes manifests. The everyday set is clone, status, add, commit, pull, push, switch or checkout for branches, log and diff.
git clone [email protected]:example-org/app.git
git switch -c fix/health-endpoint
git status
git diff
git add src/health.py
git commit -m "Return 503 when the database is unreachable"
git push -u origin fix/health-endpoint
git log --oneline -10
When something breaks after a deployment, git log and git diff between the last good and the current release are often the fastest route to the cause. For more commands, see 25 Git commands every DevOps engineer must know.
Containers and Kubernetes
12. docker
Learn to build an image, run a container, list containers, read logs and open a shell inside a running container.
docker build -t myapp:1.0 .
docker run -d --name myapp -p 8080:8080 myapp:1.0
docker ps
docker logs -f --tail 100 myapp
docker exec -it myapp sh
docker logs is an alias for docker container logs. -f follows the output, --tail limits how many lines you see first, and --since accepts a time or a duration such as 10m. Add docker ps -a to see containers that exited, which is where a crashing container usually hides.
13. kubectl
kubectl is the command-line client for Kubernetes. Freshers should be fluent with get, describe, logs, exec, apply and rollout.
kubectl get pods -o wide
kubectl describe pod my-pod
kubectl logs my-pod --previous
kubectl exec -it my-pod -- /bin/sh
kubectl get events --sort-by=.metadata.creationTimestamp
kubectl rollout status deployment/frontend
kubectl rollout undo deployment/frontend
For a Pod in CrashLoopBackOff, kubectl logs --previous shows the output of the container that crashed, and the Events section at the bottom of kubectl describe often names the cause directly, such as a failed image pull or a failed probe. Our guide to Kubernetes architecture components explains what those events refer to.
Infrastructure and configuration as code
14. terraform
Terraform describes infrastructure in code and changes it through a plan and apply cycle. The core commands are init, fmt, validate, plan and apply. In November 2026 HashiCorp's documentation lists v1.17.x as the latest Terraform CLI.
terraform init
terraform fmt
terraform validate
terraform plan -out=tfplan
terraform apply tfplan
Saving the plan with -out and applying that file means Terraform applies exactly what you reviewed. The documentation warns that a saved plan contains your configuration and values in cleartext, so treat the file as sensitive and never commit it. In pipelines, terraform plan -detailed-exitcode returns 0 for no changes, 1 for an error and 2 when changes are present.
15. ansible
The ansible command runs a single module against many hosts, which is ideal for quick checks. ansible-playbook runs full playbooks. Start with ad hoc commands to get used to inventories.
ansible all -i inventory.ini -m ansible.builtin.ping
ansible web -i inventory.ini -a "df -h"
ansible-playbook -i inventory.ini site.yml --check --diff
--check previews changes without making them and --diff shows what would change in files. For writing playbooks that behave well, read our 12 Ansible playbook tips.
Putting the commands together
A typical first troubleshooting session for "the website is down" uses most of this list in order. You ssh to the server, check the service with systemctl status, read why it failed with journalctl -u, confirm the port with ss -tlnp, check the disk with df -h, and test the endpoint with curl. If it runs in a container, docker ps -a and docker logs replace the systemd steps; on Kubernetes, kubectl get pods, describe and logs --previous do. Finally git log tells you what changed recently. Practising this sequence until it feels automatic is worth more than memorising long lists of flags.
Habits that make these commands safer
Knowing a command is half the job; using it safely on shared systems is the other half. A few habits protect you and your team.
Read before you change. Commands such as ps, df, ss, systemctl status, journalctl, kubectl get and terraform plan only read state. Run them first, understand what you see, and only then run something that changes the system. Many outages caused by newcomers come from restarting or deleting something before checking what it was doing.
Check where you are. Before any command that changes something, confirm the host name in your prompt, the current Kubernetes context with kubectl config current-context, and the Terraform workspace or directory. Running a correct command against the wrong environment is one of the most common serious mistakes in operations work, and the fix is a two-second check.
Prefer previews. Several of these tools have a way to show what would happen without doing it: terraform plan, ansible-playbook --check --diff, and kubectl diff or --dry-run=client for Kubernetes manifests. Use them every time, even when you are sure.
Keep a record. Paste the commands you ran and their key output into the ticket or incident channel. It helps teammates follow along, makes handovers easier and turns into notes you can reuse the next time the same problem appears.
Learn to read error messages fully. Most tools in this list print the cause of a failure in plain words, often near the end of the output. Reading the whole message before searching online saves a surprising amount of time.
Be careful with sudo. Run commands as your normal user unless they genuinely need root, and read a command twice before adding sudo to it, especially anything that deletes files or changes permissions recursively.
How to practise
- Start a Linux VM locally or a small cloud instance you can delete.
- Install nginx, break it on purpose (a typo in the config, a wrong permission, a full disk created with a large file), and fix it with the commands above.
- Containerise a small app, run it with Docker, then deploy it to a local Kubernetes cluster such as kind or minikube.
- Create and destroy one cloud resource with Terraform, then configure it with an Ansible ad hoc command.
- Keep a personal notes file with every command that solved a problem for you.
If you prefer structured labs, our DevOps training covers all fifteen tools hands-on, in the Kharadi, Pune classroom or live online from any other city in India. For more Linux practice, see RHEL 10 basic commands every beginner should know.
References
- journalctl manual
- ss manual page
- curl manual
- docker container logs reference
- kubectl quick reference
- terraform plan command
- ansible-playbook reference
Frequently asked questions
Which DevOps commands should a fresher learn first?
Start with Linux: ssh, grep, tail, chmod, ps, df, systemctl, journalctl, ss and curl. Then learn git, docker and kubectl, and finally terraform and ansible. The Linux commands are used inside every other tool.
Do I need to memorise every command flag?
No. Learn three or four flags per command well and look the rest up with man or --help. Interviewers care more about whether you can reason through a problem with the right command than about rare options.
What is the difference between systemctl and journalctl?
systemctl controls services: start, stop, restart, enable and status. journalctl reads the systemd journal, so it shows the log messages that explain why a service failed.
How do I check if a port is open on a Linux server?
Run sudo ss -tlnp to list listening TCP ports with the owning process. Then test the service with curl from the same server and from another machine to separate application issues from firewall issues.
Which kubectl command helps most with a crashing Pod?
kubectl logs with --previous shows the output of the container that crashed, and kubectl describe pod shows events such as image pull errors or failed probes. Use both together.
Why save a Terraform plan to a file?
terraform plan -out=tfplan followed by terraform apply tfplan applies exactly the changes you reviewed. The saved plan contains values in cleartext, so keep it out of version control.
Where can I practise these commands safely?
Use a local virtual machine or a small cloud instance you can delete, plus a local Kubernetes cluster such as kind or minikube. Break things on purpose and fix them with the commands in this guide.
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0