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

Linux Commands A-Z Part 2: chronyc, crontab, curl, cut, date, dd, df, diff, dig, dnf and du with Examples

This is Part 2 of the Linux Commands A-Z reference: chronyc to du. These are the commands you use when time is wrong, a server will not boot, files must be compared, jobs must be scheduled, a website or DNS must be tested, and a disk is full. Every command has why, what, an options table and step-by-step examples with real output and its meaning. cp is already covered in depth earlier, so it is linked.

What you'll learn in this chapter

  • Check and fix server time with chronyc and date
  • Repair a broken system with chroot and inspect kernel messages with dmesg
  • Compare files and lists with cmp, comm, diff and cksum
  • Schedule repeating jobs safely with crontab
  • Test websites and DNS with curl and dig
  • Find what fills a disk with df and du, and manage RPM packages with dnf

1. An everyday example: a PMPML bus depot at night

Why do we need this?

At the Hadapsar depot, the night supervisor checks that every bus clock matches the depot clock, compares today's route sheet with yesterday's, schedules the 5 AM departures, phones the control room to confirm the routes are open, and checks the diesel tank level before the morning rush.

What is it?

chronyc and date are the clock check. diff, comm and cmp are the route sheet comparison. crontab is the departure schedule. curl and dig are the phone call to the control room. df and du are the diesel tank level.

How to do it (step by step)

A night check on a serverClock in syncConfigs unchangedJobs scheduledSite and DNS OKDisk has roomKernel log clean
The same six checks, run with commands from this part.

2. A five-minute health check using Part 2 commands

Why do we need this?

Before you dive into one command, see how they work together in a real check.

What is it?

One command per question. Each line answers one thing a manager or on-call engineer will ask.

QuestionCommand
Is the clock right?chronyc tracking
Is the disk full?df -h
Is the site up?curl -I
Does DNS point right?dig +short
Any hardware errors?dmesg -T -l err

How to do it (step by step)

  1. Run the check in one go.
chronyc tracking | grep "System time"; df -h / | tail -1; curl -s -o /dev/null -w "%{http_code}\n" http://localhost/

Output:

System time     : 0.000040 seconds fast of NTP time
/dev/nvme0n1p1   20G  9.1G   11G  46% /
200

What it means: Clock fine, disk at 46%, web server answering 200.

  1. Add a kernel check.
sudo dmesg -T -l err | tail -2

What it means: No output means no recent kernel errors.

3. chronyc: Check and control time sync

chronyc in depth: is my server clock in sync?

Why do we need this?

Wrong time breaks TLS certificates, Kerberos and AD logins, cron jobs and log timelines. When two servers disagree by even a few minutes, debugging becomes very hard.

What is it?

chronyc is the control tool for chronyd, the NTP service on RHEL, Rocky, Amazon Linux and many Ubuntu servers. It shows the sources the server uses, how far off the clock is, and can force a step correction.

Common options

OptionWhat it does
chronyc trackingCurrent offset and stratum.
chronyc sources -vTime sources with an explanation header.
chronyc sourcestatsDrift and accuracy per source.
chronyc makestepStep the clock now.
chronyc activityHow many sources are online.
chronyc -n sourcesNumeric, no DNS lookups.

How to do it (step by step)

  1. Check the service.
systemctl is-active chronyd

Output:

active

What it means: chronyd must run for chronyc to answer.

  1. See the sources.
chronyc sources

Output:

MS Name/IP address         Stratum Poll Reach LastRx Last sample
^* 169.254.169.123               3   4   377    12   -21us[  -30us] +/-  512us

What it means: ^* marks the source in use. Reach 377 means the last 8 polls worked.

  1. How far off are we?
chronyc tracking | grep -E "System time|Stratum"

Output:

Stratum         : 4
System time     : 0.000021 seconds slow of NTP time

What it means: 21 microseconds slow: very healthy.

  1. Fix a big jump after a VM resume.
sudo chronyc makestep

Output:

200 OK

What it means: The clock jumps to the right time at once instead of slowly drifting.

Practise this in the tasks below: Practice tasks

Real use: A stock-broking firm in Deccan alerts if chronyc tracking shows more than 100 ms offset, because trade timestamps must be exact.

4. chroot: Run a shell inside another root folder

chroot in depth: repair a broken system from rescue mode

Why do we need this?

When a server cannot boot, you start a rescue disk, mount the broken root disk and need to run its own tools, such as passwd, grub2-install or dracut. chroot lets you do that.

What is it?

chroot runs a command (by default a shell) with a different folder as /. Programs inside see only that tree. It is not a security sandbox for root; containers use namespaces instead.

Common options

OptionWhat it does
chroot /mnt/sysimageShell with /mnt/sysimage as root.
chroot /sysrootUsed in rd.break root password reset.
chroot DIR cmdRun one command inside.
mount --bind /dev DIR/devGive the chroot real devices.
exitLeave the chroot.

How to do it (step by step)

  1. Mount the broken root.
mount /dev/vda4 /mnt/sys

What it means: The damaged system is now a folder.

  1. Bind the special filesystems.
for d in dev proc sys; do mount --bind /$d /mnt/sys/$d; done

What it means: Tools inside need /dev, /proc and /sys.

  1. Enter it.
chroot /mnt/sys

Output:

[root@rescue /]#

What it means: You are now "inside" the broken server.

  1. Rebuild the initramfs.
dracut -f --regenerate-all

What it means: Fixes many "cannot find root" boot errors.

  1. Leave and reboot.
exit; reboot

What it means: The server boots with the repaired files.

Practise this in the tasks below: Practice tasks

Real use: A data-centre engineer in Talawade uses chroot from a rescue ISO to reinstall GRUB on a server that stopped booting after a disk swap.

5. cksum: Print a CRC checksum and size

cksum in depth: quick CRC checks

Why do we need this?

After copying a big file between servers you want a quick check that nothing changed. cksum is on every Unix system, even very old ones.

What is it?

cksum prints a CRC-32 checksum, the size in bytes and the file name. CRC catches accidental corruption but not deliberate tampering; use sha256sum for security. Newer coreutils also support -a sha256.

Common options

OptionWhat it does
cksum fCRC and size.
cksum a bMany files.
cksum -a sha256 fUse SHA-256 (coreutils 9+).
cksum -a md5 fUse MD5.
cksum --check sumsVerify a list (with -a).

How to do it (step by step)

  1. Checksum a file.
cksum backup.tar

Output:

2741519874 3221225472 backup.tar

What it means: CRC value, then size in bytes, then name.

  1. Check the copy on the other server.
ssh dr01 cksum /backup/backup.tar

Output:

2741519874 3221225472 /backup/backup.tar

What it means: Same CRC and size: the copy is fine.

  1. Use SHA-256 if available.
cksum -a sha256 backup.tar

Output:

SHA256 (backup.tar) = 9f2c...e1

What it means: A stronger hash with the same tool.

Practise this in the tasks below: Practice tasks

Real use: A government records office in Pune checks cksum on scanned archives after each nightly copy.

6. clear: Clear the terminal screen

clear in depth: a clean screen and reset

Why do we need this?

During demos, screen-shares or long debugging, a messy screen hides the output you care about. Sometimes binary output also breaks the terminal so you see junk characters.

What is it?

clear clears the visible screen using terminal codes. Ctrl+L does the same in bash. reset re-initialises a terminal that shows garbage after you cat a binary file.

Common options

OptionWhat it does
clearClear the screen.
Ctrl+LShortcut in bash.
clear -xKeep the scrollback.
resetFix a broken terminal.
tput resetAnother way to reset.

How to do it (step by step)

  1. Clear before a demo.
clear

What it means: The prompt moves to the top.

  1. Break the terminal by mistake.
cat /usr/bin/ls

Output:

ELF>...@...(garbage)

What it means: Binary bytes change terminal settings.

  1. Fix it.
reset

What it means: Normal letters again. Type it even if you cannot see what you type.

Practise this in the tasks below: Practice tasks

Real use: A trainer at a Shivajinagar institute presses Ctrl+L between examples so students see only the next command.

7. cmp: Compare two files byte by byte

cmp in depth: are two files byte-identical?

Why do we need this?

For binary files like images, firmware or archives, diff is not helpful. You just want to know if they are the same and where they first differ.

What is it?

cmp compares two files byte by byte. It prints the first difference and exits 1, or prints nothing and exits 0 when they match. Exit code 2 means an error. That makes it perfect for scripts.

Common options

OptionWhat it does
cmp a bFirst difference.
cmp -s a bSilent, only exit code.
cmp -l a bList every differing byte.
cmp -n 100 a bCompare first 100 bytes.
cmp -i 10 a bSkip 10 bytes first.

How to do it (step by step)

  1. Compare two builds.
cmp app-v1.bin app-v2.bin

Output:

app-v1.bin app-v2.bin differ: byte 4097, line 12

What it means: They differ starting at byte 4097.

  1. Use it in a script.
cmp -s new.conf /etc/app.conf || echo "config changed"

Output:

config changed

What it means: -s prints nothing; the exit code drives the logic.

  1. Check exit code directly.
cmp -s a.png a-copy.png; echo $?

Output:

0

What it means: 0 means identical.

Practise this in the tasks below: Practice tasks

Real use: An embedded team in Bhosari checks firmware images with cmp -s before flashing devices.

8. column: Format text into neat columns

column in depth: turn messy output into a neat table

Why do we need this?

CSV files and colon-separated files like /etc/passwd are hard to read on screen. column lines them up so you can read them like a table.

What is it?

column -t creates a table, guessing column widths. -s sets the input separator. Newer util-linux versions add -o for the output separator, -N for headers and -J for JSON.

Common options

OptionWhat it does
column -tMake a table.
column -t -s,Comma separated input.
column -t -s: Colon separated input.
column -t -N A,B,CAdd header names.
column -t -J -N a,bJSON output.
column -t -o " | "Output separator.

How to do it (step by step)

  1. Read a CSV nicely.
column -t -s, sales.csv | head -3

Output:

date        city    amount
2026-10-01  Pune    1000
2026-10-01  Nashik  450

What it means: Columns are now aligned.

  1. Read /etc/passwd as a table.
head -3 /etc/passwd | column -t -s:

Output:

root    x  0  0  root    /root     /bin/bash
bin     x  1  1  bin     /bin      /sbin/nologin

What it means: Each field gets its own column.

  1. Tidy mount output.
mount | column -t | head -2

Output:

proc   on  /proc  type  proc   (rw,nosuid)
sysfs  on  /sys   type  sysfs  (rw,nosuid)

What it means: Space-separated output also works.

Practise this in the tasks below: Practice tasks

Real use: A retail analytics team in Kalyani Nagar previews CSV exports with column -t before loading them into a database.

9. comm: Compare two sorted files line by line

comm in depth: what is only in A, only in B, or in both

Why do we need this?

You have two lists, such as users on two servers or packages before and after an upgrade, and need to see what is missing or added.

What is it?

comm needs two sorted files. It prints three columns: lines only in file 1, lines only in file 2, and lines in both. -1, -2 and -3 hide columns.

Common options

OptionWhat it does
comm a bThree columns.
comm -12 a bOnly lines in both.
comm -23 a bOnly in a.
comm -13 a bOnly in b.
comm <(sort a) <(sort b)Sort on the fly.
comm --check-order a bWarn if not sorted.

How to do it (step by step)

  1. Save sorted package lists.
rpm -qa | sort > before.txt

What it means: Snapshot before the upgrade.

  1. After the upgrade, save again.
rpm -qa | sort > after.txt

What it means: Second snapshot.

  1. See only new versions.
comm -13 before.txt after.txt | head -2

Output:

kernel-5.14.0-427.el9.x86_64
openssl-3.0.7-27.el9.x86_64

What it means: Column 3 view: lines only in after.txt.

  1. Users on both servers.
comm -12 <(cut -d: -f1 /etc/passwd | sort) <(ssh web02 cut -d: -f1 /etc/passwd | sort)

Output:

arjun
priya
root

What it means: Common users only.

Practise this in the tasks below: Practice tasks

Real use: A university IT team in Ganeshkhind uses comm to find student accounts present in LDAP but missing on the lab servers.

10. crontab: Schedule repeating jobs

crontab in depth: schedule repeating jobs safely

Why do we need this?

Backups, report emails, log clean-up and certificate renewals must run every night or every hour without anyone pressing a button.

What is it?

crontab edits the per-user table read by the cron daemon (crond). Each line has five time fields (minute, hour, day of month, month, day of week) and a command. Cron runs with a small PATH and no terminal, so use full paths and log the output.

Common options

OptionWhat it does
crontab -eEdit your table.
crontab -lList your table.
crontab -rRemove your table (careful).
crontab -u user -lAnother user (root).
crontab fileInstall from a file.
*/15 * * * *Every 15 minutes.
0 2 * * 1-52 AM on weekdays.
@rebootOnce at boot.

How to do it (step by step)

  1. List current jobs.
crontab -l

Output:

no crontab for arjun

What it means: Nothing scheduled yet.

  1. Add a nightly backup at 1:30 AM.
crontab -e
30 1 * * * /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1

Output:

crontab: installing new crontab

What it means: minute 30, hour 1, every day. Output and errors go to a log.

  1. Check it is saved.
crontab -l

Output:

30 1 * * * /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1

What it means: The line is in your table.

  1. Confirm cron ran it.
sudo grep backup.sh /var/log/cron | tail -1

Output:

Oct 26 01:30:01 web01 CROND[5512]: (arjun) CMD (/usr/local/bin/backup.sh ...)

What it means: Proof of the run on RHEL. On Ubuntu use journalctl -u cron.

  1. Back up the table before editing.
crontab -l > ~/cron.bak

What it means: If someone runs crontab -r, you can restore with crontab ~/cron.bak.

Practise this in the tasks below: Practice tasks

Real use: A newspaper in Budhwar Peth uses crontab to publish the e-paper PDF at 5 AM every day.

11. curl: Talk to web servers and APIs

curl in depth: test websites and APIs from the terminal

Why do we need this?

Is the site up? Which status code? Is the certificate valid? Does the API return the right JSON? curl answers all of these from the server itself, which is where you usually debug.

What is it?

curl transfers data with URLs over HTTP, HTTPS, FTP and more. By default it prints the body. Options add headers, send JSON, follow redirects, show timings or save files.

Common options

OptionWhat it does
curl URLPrint the body.
curl -I URLHeaders only (HEAD).
curl -sSSilent but show errors.
curl -LFollow redirects.
curl -o file URLSave to a file.
curl -X POST -H "Content-Type: application/json" -d @b.jsonSend JSON.
curl -u user:passBasic auth.
curl -kSkip TLS checks (testing only).
curl -w "%{http_code}"Print chosen values.
curl --resolve host:443:IPTest a server before DNS change.

How to do it (step by step)

  1. Check headers.
curl -I https://example.com

Output:

HTTP/2 200
content-type: text/html; charset=UTF-8

What it means: 200 means OK. The headers show the type and server details.

  1. Only the status code.
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/health

Output:

200

What it means: Perfect for scripts and health checks.

  1. Time each step.
curl -s -o /dev/null -w "dns=%{time_namelookup} connect=%{time_connect} total=%{time_total}\n" https://example.com

Output:

dns=0.004 connect=0.021 total=0.183

What it means: Shows where the slowness is: DNS, connect or server.

  1. Call a JSON API.
curl -sS -X POST -H "Content-Type: application/json" -d '{"sku":"A1","qty":2}' http://localhost:8080/api/orders

Output:

{"id":1042,"status":"created"}

What it means: The API created order 1042.

  1. Test the new server before switching DNS.
curl -sI --resolve shop.example.com:443:10.0.5.20 https://shop.example.com | head -1

Output:

HTTP/2 200

What it means: curl talks to 10.0.5.20 but uses the real name for TLS.

Practise this in the tasks below: Practice tasks

Real use: A food-delivery startup in Koregaon Park runs curl -w checks every minute to catch slow payment APIs.

12. cut: Cut columns or characters from lines

cut in depth: pick columns and characters

Why do we need this?

Very often you need only one field from each line, such as user names, IPs or a date. cut is the simplest tool for fixed separators.

What is it?

cut picks fields (-f) using a one-character delimiter (-d, default tab), or characters (-c), or bytes (-b). It cannot handle many spaces in a row; use awk for that.

Common options

OptionWhat it does
cut -d: -f1Field 1, colon separator.
cut -d, -f2,4Fields 2 and 4.
cut -d, -f3-Field 3 to the end.
cut -c1-10Characters 1 to 10.
cut --complement -f2All fields except 2.
cut -d, -f1 --output-delimiter=" "Change the output separator.

How to do it (step by step)

  1. List user names.
cut -d: -f1 /etc/passwd | head -3

Output:

root
bin
daemon

What it means: Field 1 of each line.

  1. Name and home folder.
cut -d: -f1,6 /etc/passwd | tail -2

Output:

arjun:/home/arjun
priya:/home/priya

What it means: The output keeps the colon.

  1. Date part of log lines.
cut -c1-10 app.log | sort | uniq -c

Output:

  540 2026-10-25
  212 2026-10-26

What it means: Count log lines per day.

  1. Why cut fails on spaces.
echo 'a   b' | cut -d' ' -f2

What it means: Field 2 is empty because there are many spaces. awk '{print $2}' gives b.

Practise this in the tasks below: Practice tasks

Real use: An HR software team in Wakad cuts employee ids out of daily CSV attendance files with cut -d, -f1.

13. date: Show or format date and time

date in depth: show, format and calculate dates

Why do we need this?

Backups and logs need dated names. Reports need "yesterday". Incidents need UTC and IST side by side. date does all of this.

What is it?

date prints the current date and time in the system time zone. A + format string controls the output. GNU date -d understands words like yesterday and next monday. TZ changes the zone for one command.

Common options

OptionWhat it does
dateNow.
date +%F2026-10-26 format.
date +%Y%m%d-%H%MFor file names.
date -uUTC.
date -d yesterday +%FYesterday.
date -d "+7 days"A week later.
date +%sSeconds since 1970 (epoch).
date -d @1761400000Epoch to normal date.
TZ=Asia/Kolkata dateTime in another zone.

How to do it (step by step)

  1. Plain date.
date

Output:

Mon Oct 26 01:20:05 IST 2026

What it means: Shown in the server zone.

  1. A dated backup name.
tar czf "db-$(date +%F).tgz" db/ && ls db-*

Output:

db-2026-10-26.tgz

What it means: Sorts nicely and is easy to read.

  1. Yesterday for a report.
date -d yesterday +%F

Output:

2026-10-25

What it means: No maths needed.

  1. UTC and IST together.
date -u +%T; TZ=Asia/Kolkata date +%T

Output:

19:50:05
01:20:05

What it means: IST is UTC plus 5:30.

  1. Turn an epoch from a log into a date.
date -d @1761400000

Output:

Sat Oct 25 19:16:40 IST 2025

What it means: Many apps log epoch seconds.

  1. Time a step in a script.
s=$(date +%s); sleep 2; echo $(( $(date +%s) - s ))s

Output:

2s

What it means: Subtract two epochs.

Practise this in the tasks below: Practice tasks

Real use: A logistics firm in Chakan names each day's shipment export with date +%F so the files sort by day.

14. dd: Copy raw data block by block

dd in depth: raw copies, test files and bootable USBs

Why do we need this?

Some jobs need a byte-for-byte copy: writing an ISO to a USB stick, cloning a disk, making a test file of exact size, or wiping the start of a disk. dd does that, but one wrong letter can destroy a disk, so learn it carefully.

What is it?

dd copies from if= (input file) to of= (output file) in blocks of bs= size, count= times. It does not care about filesystems. status=progress shows progress. conv=fsync makes sure data reaches the disk.

Common options

OptionWhat it does
if=FILEInput.
of=FILEOutput (double-check this).
bs=4MBlock size.
count=NNumber of blocks.
status=progressShow progress.
conv=fsyncFlush to disk at the end.
oflag=directBypass cache (for speed tests).
skip=N / seek=NSkip input / output blocks.

How to do it (step by step)

  1. Make a 100 MB test file.
dd if=/dev/zero of=test.img bs=1M count=100 status=progress

Output:

104857600 bytes (105 MB, 100 MiB) copied, 0.12 s, 870 MB/s

What it means: 100 blocks of 1 MiB each.

  1. Rough disk write speed.
dd if=/dev/zero of=/data/t bs=1M count=1024 oflag=direct

Output:

1073741824 bytes (1.1 GB, 1.0 GiB) copied, 4.2 s, 256 MB/s

What it means: oflag=direct skips RAM cache, so the number is closer to the disk.

  1. Find the USB stick first.
lsblk -d -o NAME,SIZE,MODEL

Output:

sda  476G Samsung SSD
sdb   15G SanDisk Ultra

What it means: sdb is the 15 GB USB stick. Never guess.

  1. Write an ISO to it.
sudo dd if=Rocky-9.iso of=/dev/sdb bs=4M status=progress conv=fsync

Output:

2.1 GB copied, 140 s, 15 MB/s

What it means: Writes to the whole device, not a partition like sdb1.

  1. Back up the first MiB of a disk (partition table).
sudo dd if=/dev/vda of=vda-head.bin bs=1M count=1

Output:

1048576 bytes copied

What it means: A small safety copy before partition work.

Practise this in the tasks below: Practice tasks

Real use: A hardware shop in Narayan Peth writes Linux installer USBs for customers with dd, always checking lsblk first.

15. df: Show free disk space per filesystem

df in depth: free space, inodes and types

Why do we need this?

A full disk stops databases, logging and even SSH logins. df is the first thing to run when someone says "the server is slow" or "the app cannot write".

What is it?

df shows each mounted filesystem with size, used, available, use percent and mount point. -h gives human units. -i shows inodes, which can run out even when space is free. -T adds the filesystem type.

Common options

OptionWhat it does
df -hHuman readable.
df -hTWith type.
df -iInodes.
df -h /varThe filesystem holding /var.
df -x tmpfs -x devtmpfsHide memory filesystems.
df --output=target,pcentChoose columns.

How to do it (step by step)

  1. The overview.
df -h

Output:

Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p1   20G   18G  2.0G  91% /
/dev/nvme1n1    100G   40G   60G  40% /data

What it means: Root is 91% full; act before it hits 100.

  1. Only real disks with type.
df -hT -x tmpfs -x devtmpfs

Output:

/dev/nvme0n1p1 xfs 20G 18G 2.0G 91% /

What it means: Memory filesystems are hidden.

  1. Inodes full?
df -i /var

Output:

Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/vda3 655360 655360 0 100% /var

What it means: Space may be free, but no new file can be made. Usually millions of tiny files.

  1. Script-friendly use percent.
df --output=pcent / | tail -1 | tr -dc 0-9

Output:

91

What it means: Just the number, ready for an alert check.

Practise this in the tasks below: Practice tasks

Real use: A hospital PACS team in Erandwane watches df on the image store every hour, because a full disk stops X-ray uploads.

16. diff: Show differences between files

diff in depth: what changed between two files

Why do we need this?

After an upgrade or a colleague's change, you need to know exactly what changed in a config. diff shows it line by line and makes patches you can share.

What is it?

diff compares two text files. The default format uses < and >. -u gives the unified format used by git and patch, with - for removed and + for added lines. -r compares folders. Exit code 0 means same, 1 means different.

Common options

OptionWhat it does
diff a bDefault format.
diff -u a bUnified format.
diff -y a bSide by side.
diff -r d1 d2Compare folders.
diff -q d1 d2Only say which files differ.
diff -w a bIgnore spaces.
diff -i a bIgnore case.
diff <(cmd1) <(cmd2)Compare command outputs.

How to do it (step by step)

  1. Unified diff of a config.
diff -u nginx.conf.bak /etc/nginx/nginx.conf

Output:

--- nginx.conf.bak
+++ /etc/nginx/nginx.conf
@@ -12 +12 @@
-    worker_connections 768;
+    worker_connections 4096;

What it means: One line changed: 768 became 4096.

  1. Side by side for quick reading.
diff -y --width=60 a.txt b.txt

Output:

port=80        |  port=8080
user=web          user=web

What it means: | marks a changed line.

  1. Which files differ in two releases?
diff -rq release-41/ release-42/

Output:

Files release-41/app.py and release-42/app.py differ
Only in release-42/: migrate.sql

What it means: Quick summary across folders.

  1. Compare two servers' configs.
diff <(ssh web01 cat /etc/app.conf) <(ssh web02 cat /etc/app.conf)

Output:

3c3
< threads=8
---
> threads=4

What it means: web02 runs fewer threads. That explains the slowness.

  1. Make and apply a patch.
diff -u old.conf new.conf > fix.patch && patch old.conf < fix.patch

Output:

patching file old.conf

What it means: old.conf now matches new.conf.

Practise this in the tasks below: Practice tasks

Real use: An insurance company in Yerawada uses diff -u in change tickets so reviewers see exactly which config lines change.

17. dig: Query DNS records

dig in depth: ask DNS exactly what you want

Why do we need this?

"It is always DNS" is a joke among admins because so many outages are DNS problems. dig shows exactly what a DNS server answers, which record, and for how long it will be cached.

What is it?

dig (from bind-utils or dnsutils) sends DNS queries. You choose the name, the record type (A, AAAA, MX, CNAME, TXT, NS) and the server with @. +short trims the output; +trace follows the chain from the root servers.

Common options

OptionWhat it does
dig nameA record with full details.
dig +short nameOnly the answer.
dig name MXMail servers.
dig name TXTTXT records (SPF, verification).
dig @8.8.8.8 nameAsk a specific server.
dig -x IPReverse lookup.
dig +trace nameFollow from the root.
dig +noall +answer nameOnly the answer section.

How to do it (step by step)

  1. Quick answer.
dig +short example.com

Output:

93.184.215.14

What it means: The IP the name points to.

  1. See TTL.
dig +noall +answer example.com

Output:

example.com.  3600  IN  A  93.184.215.14

What it means: 3600 seconds: resolvers cache this for up to one hour.

  1. Check mail servers.
dig +short gmail.com MX

Output:

5 gmail-smtp-in.l.google.com.
10 alt1.gmail-smtp-in.l.google.com.

What it means: Lower number = higher priority.

  1. Compare your DNS with public DNS.
dig +short shop.example.in; dig +short @1.1.1.1 shop.example.in

Output:

10.0.5.10
203.0.113.20

What it means: Internal DNS gives a private IP; public DNS gives the public one. Normal for split DNS.

  1. Reverse lookup.
dig +short -x 8.8.8.8

Output:

dns.google.

What it means: Which name owns an IP.

Practise this in the tasks below: Practice tasks

Real use: An e-commerce team in Hinjewadi checks dig against several resolvers right after moving its site to a new load balancer.

18. dirname: Get the folder part of a path

dirname in depth: the folder part of a path

Why do we need this?

Scripts often need the folder a file is in, for example to create it first or to find files next to the script.

What is it?

dirname removes the last part of a path and prints the rest. If there is no slash it prints a dot. Like basename it works on text only. Bash can do ${p%/*}.

Common options

OptionWhat it does
dirname PATHFolder part.
dirname a/b c/dMany paths.
dirname -zUse NUL at the end.
"$(dirname "$0")"Folder of the running script.
${p%/*}Pure bash way.

How to do it (step by step)

  1. Simple.
dirname /var/log/nginx/access.log

Output:

/var/log/nginx

What it means: The file name is removed.

  1. No slash.
dirname notes.txt

Output:

.

What it means: Dot means the current folder.

  1. Find files next to your script.
cd "$(dirname "$0")" && ls

Output:

deploy.sh  config.env

What it means: The script works from anywhere.

  1. Create the parent before writing.
out=/srv/reports/2026/10/sales.csv; mkdir -p "$(dirname "$out")"

What it means: The folder tree exists before the file is saved.

Practise this in the tasks below: Practice tasks

Real use: A reporting script at a Pune pharma company uses dirname to make month folders before writing each report.

19. dmesg: Read kernel messages

dmesg in depth: kernel messages about disks, memory and hardware

Why do we need this?

When a disk fails, a USB device is added, the OOM killer kills a process or a network card resets, the kernel writes a message. dmesg is where you read it.

What is it?

dmesg prints the kernel ring buffer. -T shows readable times, -l filters by level, -w waits for new messages. On many systems normal users need sudo. journalctl -k shows the same kernel log with persistence.

Common options

OptionWhat it does
dmesg -THuman times.
dmesg -l err,warnErrors and warnings.
dmesg -wFollow new messages.
dmesg -HPretty, paged output.
dmesg | grep -i oomFind OOM kills.
dmesg -cPrint then clear (root).
journalctl -k -b -1Kernel log of the last boot.

How to do it (step by step)

  1. Recent errors.
sudo dmesg -T -l err,warn | tail -3

Output:

[Mon Oct 26 00:12:01 2026] EXT4-fs warning (device nvme1n1): ext4_end_bio: I/O error 10

What it means: I/O errors often mean a failing disk.

  1. Why did my Java process die?
sudo dmesg -T | grep -i "killed process"

Output:

[Mon Oct 26 00:40:11 2026] Out of memory: Killed process 2211 (java) total-vm:8123456kB

What it means: The kernel OOM killer stopped it; the server ran out of RAM.

  1. Watch while you plug in a disk.
sudo dmesg -wT

Output:

[...] sd 2:0:0:0: [sdb] 31457280 512-byte logical blocks: (16.1 GB/15.0 GiB)

What it means: The new disk is sdb. Press Ctrl+C to stop.

Practise this in the tasks below: Practice tasks

Real use: A cloud support engineer in Magarpatta checks dmesg for OOM kills whenever a customer says "the app restarts by itself".

20. dnf: Install packages on RHEL, Fedora, Amazon Linux

dnf in depth: packages on RHEL, Rocky, Fedora and Amazon Linux 2023

Why do we need this?

Most enterprise Linux in Indian companies and banks is RHEL or a RHEL rebuild. You install software, patch CVEs, roll back bad updates and find which package gives a file, all with dnf.

What is it?

dnf resolves dependencies and installs RPM packages from repositories in /etc/yum.repos.d/. It keeps a history you can undo. yum on RHEL 8 and 9 is a link to dnf.

Common options

OptionWhat it does
dnf install -y pkgInstall.
dnf remove pkgRemove.
dnf upgradeUpgrade all.
dnf check-updateWhat can be upgraded.
dnf updateinfo list --securitySecurity updates.
dnf search wordSearch.
dnf info pkgPackage details.
dnf provides /pathWhich package owns a file.
dnf historyPast transactions.
dnf history undo NUndo transaction N.
dnf repolistEnabled repositories.
dnf module listModule streams (RHEL 8/9).

How to do it (step by step)

  1. Which repos are on?
dnf repolist

Output:

repo id        repo name
appstream      Rocky Linux 9 - AppStream
baseos         Rocky Linux 9 - BaseOS

What it means: Two main RHEL-family repos.

  1. Install a web server.
sudo dnf install -y httpd

Output:

Installed:
  httpd-2.4.57-11.el9.x86_64 ...
Complete!

What it means: Dependencies came automatically.

  1. Find the package for a missing command.
dnf provides */bin/dig

Output:

bind-utils-32:9.16.23-18.el9.x86_64 : Utilities for querying DNS name servers

What it means: Install bind-utils to get dig.

  1. Security fixes only.
sudo dnf upgrade --security -y

Output:

Upgraded: openssl-1:3.0.7-27.el9 ...

What it means: Good for quick CVE patching.

  1. Undo a bad change.
sudo dnf history | head -4 && sudo dnf history undo 14 -y

Output:

ID | Command line | Date and time | Action(s)
14 | install httpd | 2026-10-26 01:30 | Install

What it means: Transaction 14 is reversed.

Practise this in the tasks below: Practice tasks

Real use: A bank data centre in Pune patches RHEL servers monthly with dnf upgrade --security and keeps dnf history ids in the change ticket for rollback.

21. du: Show how much space folders use

du in depth: what is eating the disk?

Why do we need this?

df tells you a disk is full. du tells you which folder is using the space, so you know what to clean or move.

What is it?

du adds up the space used by files and folders. -s gives one total per argument, -h human units, -d sets depth, -x stays on one filesystem. Deleted but still open files are not counted, so df and du can disagree.

Common options

OptionWhat it does
du -sh dirTotal for dir.
du -h -d1 dirOne level deep.
du -xh -d1 /Stay on the root filesystem.
du -sh * | sort -hRank items by size.
du -ah dirInclude files.
du --exclude=*.isoSkip a pattern.
du -c a bGrand total.

How to do it (step by step)

  1. Total of a folder.
sudo du -sh /var/log

Output:

4.2G	/var/log

What it means: Logs are 4.2 GB.

  1. Biggest folders under /var.
sudo du -xh -d1 /var | sort -h | tail -4

Output:

310M	/var/cache
1.1G	/var/lib
4.2G	/var/log
5.7G	/var

What it means: /var/log is the big one.

  1. Dig one more level.
sudo du -sh /var/log/* | sort -h | tail -2

Output:

600M	/var/log/journal
3.4G	/var/log/app

What it means: The app logs need rotation.

  1. Largest files.
sudo find /var/log -type f -size +500M -exec du -h {} + | sort -h

Output:

2.9G	/var/log/app/debug.log

What it means: One debug log is 2.9 GB.

  1. df and du disagree?
sudo lsof +L1 | head -3

Output:

java 2211 app 12w REG 259,1 2147483648 0 1234 /var/log/app/old.log (deleted)

What it means: A deleted file is still held open; restart the process to free the space.

Practise this in the tasks below: Practice tasks

Real use: A video-streaming startup in Balewadi runs du -xh -d1 when its transcoding server fills up, then clears the temp chunks.

22. Commands in this range already covered in depth

Why do we need this?

These commands already have a full why, what and how section in an earlier chapter. Repeating them here would only make the page longer.

What is it?

Each link opens the exact section with options, examples and output.

How to do it (step by step)

  • cp: Copy files and folders: -r, -i, -v and -p

23. Real examples from many industries

Why do we need this?

The same Linux skill shows up in every kind of company. Seeing it in many places helps you remember it.

What is it?

Each row is a made-up team. It shows who uses this and how.

How to do it (step by step)

Team and cityHow they use itCommand
Aditya, broking, DeccanAlerts on clock offset over 100 mschronyc tracking
Swati, e-commerce, HinjewadiChecks DNS after a load balancer movedig +short @1.1.1.1 shop.example.in
Nikhil, payments, Koregaon ParkTimes payment API calls every minutecurl -s -o /dev/null -w "%{time_total}" URL
Rupali, bank DC, PuneMonthly RHEL patching with rollback idsdnf upgrade --security -y
Omkar, video startup, BalewadiFinds what fills the transcoding diskdu -xh -d1 / | sort -h
Neha, insurance, YerawadaPuts config diffs in change ticketsdiff -u old.conf new.conf

24. Common errors and how to fix them

Why do we need this?

Everyone hits these errors. Knowing the cause saves hours.

What is it?

Read the exact message first. Then match it to a row below.

How to do it (step by step)

Error you seeWhy it happensHow to fix
506 Cannot talk to daemonchronyd is not runningStart the service.
systemctl enable --now chronyd
chroot: failed to run command '/bin/bash': No such file or directoryWrong folder or root disk not mountedMount the right partition first.
lsblk -f; ls /mnt/sys/bin/bash
comm: file 1 is not in sorted orderInput not sortedSort both inputs.
comm <(sort a) <(sort b)
Cron job runs by hand but not from cronCron has a small PATH and no envUse full paths and log output.
PATH=/usr/local/bin:/usr/bin:/bin
curl: (60) SSL certificate problem: unable to get local issuer certificateMissing CA bundle or a broken chain on the serverFix the chain; update CA certificates.
openssl s_client -connect host:443 -showcerts
curl: (7) Failed to connect to localhost port 8080: Connection refusedNothing is listening on that portStart the app or check the port.
ss -ltnp | grep 8080
cut: the delimiter must be a single characterUsed -d with two charactersUse one character or switch to awk.
awk -F'::' '{print $2}' f
date: invalid date 'yesterdy'Typing mistake in -d textFix the word.
date -d yesterday
dd: failed to open '/dev/sdb': Permission deniedNeeds rootUse sudo, after checking lsblk.
lsblk; sudo dd ...
No space left on device (but df shows free space)Inodes are fullFind folders with many tiny files.
df -i; du --inodes -d2 /var | sort -n | tail
;; connection timed out; no servers could be reachedDNS server unreachable or blockedCheck resolv.conf and port 53.
cat /etc/resolv.conf; nc -vzu 8.8.8.8 53
Error: Failed to download metadata for repo 'appstream'No internet, proxy or a bad mirrorCheck network, then clean cache.
dnf clean all; dnf makecache

25. Troubleshooting step by step

Why do we need this?

When a Part 2 command misbehaves, go through these steps.

What is it?

Go top to bottom. Stop at the first step that shows the problem.

How to do it (step by step)

  1. Is the service behind it running (chronyd, crond)?
systemctl is-active chronyd crond
  1. Can you reach the network?
ping -c2 8.8.8.8
  1. Is DNS working?
dig +short example.com
  1. Is the disk or inode table full?
df -h /; df -i /
  1. Did the kernel log anything?
sudo dmesg -T | tail -5
  1. What changed recently?
sudo dnf history | head -5

26. Lab 1: Find and fix a full disk

Why do we need this?

Fill a test folder, find it with df and du, then clean it and schedule automatic cleanup.

What is it?

A full hands-on lab. Run every step on a test Linux machine (an EC2 instance, a VM, or WSL).

How to do it (step by step)

  1. Create big test files.
mkdir -p /tmp/lab9 && for i in 1 2 3; do dd if=/dev/zero of=/tmp/lab9/f$i bs=1M count=200 status=none; done
  1. See the disk.
df -h /tmp

Output:

tmpfs 1.8G 600M 1.2G 33% /tmp
  1. Find the folder.
du -sh /tmp/* 2>/dev/null | sort -h | tail -1

Output:

600M	/tmp/lab9
  1. Delete old files.
find /tmp/lab9 -name "f*" -mmin +0 -delete; du -sh /tmp/lab9

Output:

0	/tmp/lab9
  1. Schedule nightly cleanup.
(crontab -l 2>/dev/null; echo "15 2 * * * find /tmp/lab9 -type f -mtime +1 -delete") | crontab -
  1. Confirm.
crontab -l | tail -1

Output:

15 2 * * * find /tmp/lab9 -type f -mtime +1 -delete

27. Lab 2: Check a website end to end

Why do we need this?

Check DNS, connection timing, status code and the TLS date of a site, and compare two server configs.

What is it?

A full hands-on lab. Run every step on a test Linux machine (an EC2 instance, a VM, or WSL).

How to do it (step by step)

  1. DNS answer and TTL.
dig +noall +answer example.org

Output:

example.org. 3600 IN A 93.184.215.14
  1. Status code.
curl -s -o /dev/null -w "%{http_code}\n" https://example.org

Output:

200
  1. Timing.
curl -s -o /dev/null -w "dns=%{time_namelookup} tls=%{time_appconnect} total=%{time_total}\n" https://example.org

Output:

dns=0.003 tls=0.090 total=0.170
  1. Certificate end date.
echo | openssl s_client -connect example.org:443 2>/dev/null | openssl x509 -noout -enddate

Output:

notAfter=Jan 15 23:59:59 2027 GMT
  1. Make two configs.
printf 'port=80\nthreads=8\n' > a.conf; printf 'port=80\nthreads=4\n' > b.conf
  1. Compare.
diff -u a.conf b.conf

Output:

-threads=8
+threads=4

Ravindra Bagale's Tip

Make two habits today. One: before any risky change, save a copy and later compare it with diff -u. Two: whenever you add a cron line, send its output to a log file. These two habits alone will save you during most late-night incidents.

28. Frequently asked questions

Q. Why is df different from du?

du cannot see deleted files that are still open, and it skips other mounts with -x. Check lsof +L1.

Q. cron or systemd timer?

Both work. Timers give logs in journalctl and handle missed runs; cron is simpler and everywhere.

Q. Is curl -k safe?

Only for testing. It turns off certificate checks.

Q. dig or nslookup?

dig gives more detail and is preferred by admins. nslookup is in a later part.

Q. Can dd damage my laptop disk?

Yes, if of= points to it. Always check lsblk first.

Q. Is yum gone?

On RHEL 8 and 9, yum is just a link to dnf.

Q. Why does my cron job not see my variables?

Cron does not read your .bashrc. Set variables in the crontab or the script.

Q. Where is cp?

Linked above under commands already covered.

29. Interview questions and answers

Beginner level

Q. What do the five cron fields mean?

Minute, hour, day of month, month, day of week.

Q. How do you check free disk space?

df -h.

Q. How do you see only HTTP headers?

curl -I URL.

Q. How do you get yesterday's date?

date -d yesterday +%F.

Mid level level

Q. Disk is full but du shows little. Why?

A deleted file is still open; find it with lsof +L1 and restart the process.

Q. How do you check which DNS server answers?

dig name shows SERVER: at the bottom; dig @server name tests one.

Q. How do you undo a bad package update?

dnf history then dnf history undo ID.

Q. What does chronyc makestep do?

Steps the clock at once instead of slewing.

Senior level

Q. Root password lost on RHEL 9. Steps?

rd.break, mount -o remount,rw /sysroot, chroot /sysroot, passwd, touch /.autorelabel.

Q. How to test a new server before DNS cutover?

curl --resolve host:443:NEWIP https://host.

Q. Design a safe cron for backups across 200 servers.

Random delay, flock to prevent overlap, logs, alert on failure, and a central check.

Try at home

  1. Run the five-minute health check on your own VM and save the output with today's date in the name.
  2. Add a cron job that writes date to a file every 5 minutes; check it after 15 minutes, then remove it.
  3. Use dig on three sites you use daily and note their TTLs.

Practice Tasks

About this scenario

London Legal LLP is a law business in London. Oliver Hughes looks after its IT and cloud work. They count money in GBP and run their AWS resources in the eu-west-2 Region. In the tasks below you do real jobs for them using what this lesson teaches. All names, account IDs, IP addresses and numbers are made up for practice.

0 / 20

Easy Numeric sources

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: List chrony source statistics without DNS lookups.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Easy Numeric tracking

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Show chrony tracking with numeric addresses only.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Easy Save a file

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Download https://example.com/a.tar.gz keeping its remote file name, following redirects.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Easy Next Monday

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Print the date of next monday as YYYY-MM-DD.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Easy Warnings only

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Show kernel messages of level warn only with readable times.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Medium First bytes only

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Compare only the first 512 bytes of disk1.img and disk2.img.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Medium Only in second

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Show lines only in new.txt when compared with old.txt (both sorted).

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Medium Another user's cron

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: As root, list the crontab of user deploy.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Medium Basic auth

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Call http://localhost:9000/api/health with user admin and password Pune123 showing headers only.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Medium All but one field

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Print all comma fields of emp.csv except field 3.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Medium UTC ISO time

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Print the current time in UTC in ISO 8601 with seconds.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Medium Choose df columns

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Show only source, size and available columns for /home in human units.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Medium Ignore spacing

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Compare a.yml and b.yml ignoring all white space, unified format.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Medium Name servers

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: List only the name servers of example.org.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Hard Run one command inside

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Run passwd for user root inside /mnt/sys without opening a shell.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Hard JSON table

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Turn space-separated users.txt into JSON with column names name and uid.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Hard Weekend schedule

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Write the cron time fields for 6:45 AM on Saturday and Sunday only.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Hard Skip blocks

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Copy 1 MiB from disk.img starting after the first 10 MiB into part.bin.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Hard Info on one transaction

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Show the details of dnf transaction 22.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Hard Inode hogs

Why: BIZ runs Linux servers and uses commands from chronyc to du daily.

What to do: Show inode counts per folder one level under /var.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

In short

  1. chronyc and date: time.
  2. cmp, comm, diff, cksum: compare.
  3. crontab: five fields, full paths, log output.
  4. curl and dig: web and DNS checks.
  5. df vs du: free space vs who uses it.
  6. dnf history undo rolls back.

Revision, comparison and interview cards

Revise this lesson in a few minutes. Save the cards on your phone or download them as PNG files. The QR code on each card opens this lesson.

Disk full?. Which filesystem. Inodes too. Biggest folders. Kernel errors.
Revision card: Disk full? · Download PNG · Open card page
Check a web service. DNS answer. HTTP status. Timing. Clock in sync.
Revision card: Check a web service · Download PNG · Open card page
df vs du. Filesystem view. / File and folder view.
Comparison: df vs du · Download PNG · Open card page
diff vs cmp. Line by line. / Byte by byte.
Comparison: diff vs cmp · Download PNG · Open card page
df full but du small?. Deleted file still open. Find it. Restart that service.
Interview card: df full but du small? · Download PNG · Open card page
Why is dd dangerous?. It writes raw blocks. Wrong of= wipes a disk. Check first.
Interview card: Why is dd dangerous? · Download PNG · Open card page
Cron job did not run?. Cron has a tiny PATH. Use full paths and log. Check the log.
Interview card: Cron job did not run? · Download PNG · Open card page
Test an API from a server?. Show headers. Fail on HTTP errors. Send JSON.
Interview card: Test an API from a server? · Download PNG · Open card page

More cards: Ravi Sir's Cards.