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

Guides

हर दिन DevOps Engineer जो Linux Commands इस्तेमाल करता है

Amazon Linux/Ubuntu पर DevOps की रोज़ की भाषा। Infosys, TCS style on-call की तरह output सीखें।

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

Quick answer

Hold this vertical picture:

  1. df/du।
  2. ps/uptime।
  3. ss/curl।
  4. systemctl/journalctl।
  5. हर outage यही क्रम।

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

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

ये commands रोज़ क्यों

Flipkart sale या Infosys client धीमा हो तो seniors किताब नहीं खोलते। Disk, process, port, log checks चलते हैं।

Why: तेज़ triage MTTR बचाता है। What: Sample output के साथ छोटा daily set। How: अपनी VM पर अभ्यास। हर column पढ़ें।

Concept 1: Disk और memory

Why: Full disk apps मारता है। What: df, du, free, df -i। How: पहले / और /var।

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: Process और load

Why: एक runaway process box भूखा रखता है। What: ps, top, uptime। How: CPU से sort करें।

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 और HTTP

Why: गलत bind घंटे बर्बाद। What: ss, curl, scp। How: Restart से पहले listen confirm।

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 और journals

Why: systemctl = service control plane। What: is-active, journalctl -u। How: Blind restart से पहले logs।

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

Pune app server

रात 2 बजे disk full। du से /var/log मिलता है।

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. / पर disk percent?

df -h /

Q2. ss -tulpn?

Listening ports और processes।

Q3. journalctl पहले क्यों?

Fail का कारण जानने के लिए।

Q4. Load average?

1, 5, 15 मिनट के averages।

Q5. Disk full पर पहला folder?

अक्सर /var/log।

Reading tracking

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

क्रम: disk → process → ports → logs। 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.