Ravindra BagaleCourses & study guides मराठी Track your progress

Guides

Linux Commands Every DevOps Engineer Uses Daily

These Linux commands are the daily language of DevOps on Amazon Linux and Ubuntu. Learn names with sample output — the way Infosys, TCS and product on-call teams triage.

Friends, memorize the order: disk, process, ports, logs. Chala mitrano — type them until muscle memory.

Quick answer

Hold this vertical picture:

  1. Disk with df/du.
  2. Process with ps/uptime.
  3. Ports with ss/curl.
  4. Services with systemctl/journalctl.
  5. Same order every outage.

Language: English · मराठी · हिंदी

df / du / freeDisk and memory ps / top / uptimeCPU and load ss / curlPorts and HTTP systemctl / journalctlService + logs
Daily Linux outage path

Why these commands matter every day

When Flipkart sale traffic or an Infosys client portal is slow, seniors do not open a textbook. They run disk, process, port and log checks.

Why: Fast triage saves MTTR. What: A short daily set with sample output. How: Practice on your own VM. Read every column.

Concept 1: Disk and memory

Why: Full disks kill apps silently. What: df, du, free, df -i. How: Check / and /var first.

Example 1: Disk free

Type this:

df -h /

You will see:

Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p1   8.0G  3.1G  4.9G  39% /

What it means: Root at 39 percent. Above 90 percent needs cleanup.

Example 2: Biggest dirs

Type this:

du -h -d1 /var 2>/dev/null | sort -h | tail -3

You will see:

1.2G    /var/log
2.0G    /var/lib
3.4G    /var

What it means: /var/log often fills first on app servers.

Example 3: Inode check

Type this:

df -i / | tail -1

You will see:

/dev/nvme0n1p1  524288  81234  443054  16% /

What it means: Inode exhaustion can block creates even when bytes remain.

Concept 2: Processes and load

Why: One runaway process can starve the box. What: ps, top, uptime. How: Sort by CPU; know load averages.

Example 4: Top CPU snapshot

Type this:

ps aux --sort=-%cpu | head -n 4

You will see:

USER PID %CPU %MEM COMMAND
root 1 0.0 0.2 systemd
...

What it means: Read the COMMAND column in outages.

Example 5: Memory free

Type this:

free -h

You will see:

total used free
Mem: 3.7Gi 1.2Gi 1.1Gi

What it means: Watch available, not only free.

Example 6: Load average

Type this:

uptime

You will see:

14:02:11 up 3 days,  2 users,  load average: 0.15, 0.10, 0.05

What it means: Three numbers: 1, 5, 15 minute averages.

Concept 3: Ports and HTTP

Why: Wrong bind address wastes hours. What: ss, curl, scp pattern. How: Confirm listen ports before restart wars.

Example 7: Listen ports

Type this:

ss -tulpn | head -n 5

You will see:

Netid State Local Address:Port
tcp LISTEN 0.0.0.0:22
tcp LISTEN 0.0.0.0:80

What it means: See who owns port 80 before nginx fights.

Example 8: HTTP check

Type this:

curl -s -o /dev/null -w "%{http_code}\n" https://example.com/

You will see:

200

What it means: 200 means the edge answered. Not a full app health check.

Example 9: Copy with scp mind-set

Type this:

printf '%s\n' 'scp report.txt ec2-user@10.0.0.5:/home/ec2-user/'

You will see:

scp report.txt ec2-user@10.0.0.5:/home/ec2-user/

What it means: Use keys; never paste passwords into scripts.

Concept 4: Services and journals

Why: systemctl is the control plane for services. What: is-active, status, journalctl -u. How: Always read logs before a blind restart.

Example 10: Service active?

Type this:

systemctl is-active sshd || systemctl is-active ssh

You will see:

active

What it means: active means accepting connections.

Example 11: Recent journal

Type this:

journalctl -u sshd -n 3 --no-pager 2>/dev/null || journalctl -u ssh -n 3 --no-pager

You will see:

-- Logs begin --
... Started OpenSSH ...

What it means: journalctl is the first log stop on systemd hosts.

Example 12: Follow pattern

Type this:

printf '%s\n' 'ss -> process -> journalctl -> restart'

You will see:

ss -> process -> journalctl -> restart

What it means: Daily outage order at Infosys-style accounts.

Pocket order

  1. df -h /
  2. free -h
  3. ss -tulpn
  4. systemctl status NAME
  5. journalctl -u NAME -n 50

Suppose: Pune colocated app server

Disk full at 2 a.m. du finds /var/log. Clean, then add logrotate.

Suppose: London SaaS API

ss shows nothing on 443. Fix the listen address, not the code first.

Ravindra Bagale's Tip

On Amazon Linux and Ubuntu labs used at TCS and Capgemini projects, these ten commands solve most night calls. Learn sample output, not only names.

Check yourself (quiz)

Q1. Which command shows disk percent on /?

df -h /

Q2. What does ss -tulpn show?

Listening TCP/UDP ports and processes.

Q3. Why journalctl before restart?

So you know why it failed.

Q4. What is load average?

1, 5 and 15 minute run-queue averages.

Q5. First folder to check when disk is full?

Often /var/log.

Reading tracking

Mark this guide when you finish. Your browser remembers it on this device.

Daily path: disk → process → ports → logs. Practice output, not only names. Did you understand? Let us try it once more.

Frequently asked questions

Which command shows disk percent on /?

df -h /

What does ss -tulpn show?

Listening TCP/UDP ports and processes.

Why journalctl before restart?

So you know why the service failed.

What is load average?

1, 5 and 15 minute run-queue averages.

First folder when disk is full?

Often /var/log.

Daily outage order?

disk → process → ports → logs.