Skip to contentSkip to Braille Studio
ALB Wiki

Ogslay Onitoringmay andway Imetay

Away Inuxlay ystemsay arratesnay itselfway onstantlycay — everyway aemonday'say omplaintscay, everyway oginlay, everyway ernelkay arningway, everyway ervicesay'say ifecyclelay andslay inway ogslay. Ethay isciplineday isway owingknay erewhay eythay ivelay andway owhay otay eadray emthay. Isthay apterchay overscay ethay otway ogginglay orldsway (yslogsay ilesfay andway ournaldjay), ethay onitoringmay oolkittay, andway ethay ockclay achinerymay — Ntpay, imezonestay, ocaleslay — ethay uietqay infrastructureway everyway otherway apterchay eanslay onway.

Ethay otway ogginglay orldsway

Yslogsay ilesfay — ethay assicclay: /arvay/oglay/ oldshay exttay ilesfay, otatedray, eppablegray:

ls -lt /var/log/           # freshest first
tail -f /var/log/syslog    # Debian's main
tail -f /var/log/messages  # Slackware/RH's main
less /var/log/auth.log     # logins, sudo, sshd
less /var/log/kern.log     # the kernel
grep 'error' /var/log/syslog | tail
logrotate                  # the rotator — /etc/logrotate.conf + .d

ournaldjay — ystemdsay'say ucturedstray inarybay oglay:

journalctl                 # everything, this boot
journalctl -b              # this boot only
journalctl -b -1           # LAST boot — the crash forensics
journalctl -u sshd         # one unit
journalctl -p err          # by priority — emerg..debug
journalctl -f              # follow live
journalctl --since "1 hour ago" --until "10 min ago"
journalctl -k              # kernel messages
journalctl -x              # + explanations
journalctl --disk-usage    # how much it stores
journalctl --vacuum-size=100M   # trim it

Ethay -bay -1 icktray — ethay eviouspray ootbay'say oglay — isway ethay inglesay ostmay usefulway orensicfay ommandcay onway ystemdsay ystemssay: ethay oglay ofway ethay ootbay atthay ailedfay.

esgdmay — ethay ernelkay'say ownway oicevay

dmesg                      # the ring buffer — hardware, drivers, oopses
dmesg -T                   # human timestamps
dmesg -l err,warn          # filtered by level
dmesg -w                   # follow live
dmesg | grep -i usb        # device arrivals

esgdmay isway erewhay ardwarehay announcesway itselfway — ootbay'say anscripttray, USBway ugplay-insway, iskday Iway/Oway errorsway, ernelkay oopsesway — ethay irstfay aceplay otay ooklay enwhay ardwarehay isbehavesmay.

Ethay ournaljay'say ieldsfay — ethay ueryableqay ayerlay

journalctl _SYSTEMD_UNIT=sshd.service   # by unit
journalctl _PID=1234                    # by process
journalctl _UID=1000                    # by user
journalctl _COMM=sshd                   # by command name
journalctl SYSLOG_IDENTIFIER=crond      # by syslog id
journalctl -g 'Failed.*password'        # regex the messages
journalctl -o json                      # structured — jq-able
journalctl -o short-iso-precise         # precise timestamps
journalctl --since '2024-01-01' --until '2024-01-02'
journalctl --since 'yesterday' --until 'now'
journalctl -u sshd --since today -f     # unit + time + follow
journalctl --field _TRANSPORT           # list a field's values
journalctl --vacuum-time=7d             # trim by age
journalctl --vacuum-files=20            # keep N files

yslogsay — ethay assicclay ilefay ammargray

/var/log/messages      # RH/Slackware's main
/var/log/syslog        # Debian's main
/var/log/auth.log      # Debian auth · /var/log/secure on RH
/var/log/kern.log      # kernel
/var/log/daemon.log    # services
/var/log/mail.log      # mail
/var/log/cron          # cron
/var/log/dmesg         # boot's kernel transcript
/var/log/wtmp btmp     # logins (binary — `last`/`lastb` read)
/var/log/faillog lastlog   # failed/last logins
/var/log/Xorg.0.log    # the display

ogrotatelay otatesray emthay — /etcway/ogrotatelay.onfcay + .day/, ailyday/eeklyway/izesay-iggeredtray, .1 .2 .gzay archivesway. atzcay/esszlay/epzgray eadray ethay ompressedcay onesway ithoutway unrollingway.

Ethay atchersway — onitoringmay

top                        # the classic live view
htop                       # the better one — per-core bars, trees, search
ps aux --sort=-%cpu | head # the static snapshot
free -h                    # memory — used/free/cached
vmstat 1                   # the pulse — cpu, io, memory per second
iostat -x 1                # per-disk io
mpstat -P ALL 1            # per-CPU
dstat -cdn                 # the everything-monitor
uptime                     # load averages — 1/5/15 min
watch -n2 'command'        # any command as a live monitor

Oadlay averageway interpretationway: 4.0 onway 4 orescay = ullyfay oadedlay; onway 8 orescay = alfhay. eefray'say availableway olumncay isway ealray eefray emorymay — uffbay/achecay isway eclaimableray, otnay "usedway".

Ethay onitoringmay ammargray — eadingray away ystemsay ivelay

top                    # M=mem-sort P=cpu-sort 1=per-core k=kill c=full-cmd
htop                   # the better one — trees, meters, search
free -h                # memory — MemFree vs available vs buff/cache
vmstat 1 5             # 5 samples at 1s — cpu, io, memory per line
iostat -x 1            # per-disk utilization — %util, await
mpstat -P ALL 1        # per-CPU
pidstat 1              # per-process
dstat -cdn --top-cpu --top-mem   # the everything
sar -u 1               # the sysstat historian
sar -n DEV 1           # per-interface net
iostat -x | sort -k10  # busiest disks
watch -n1 'ps aux --sort=-%mem | head'  # your own monitor

eefray -hay'say availableway isway ethay ealray eefray; uffbay/achecay isway eclaimableray. Oadlay 4.0 onway 4 Uscpay = aturatedsay. atvmstay'say isay/osay = apsway-inway/outway — onzeronay isway emorymay essurepray.

Ethay ocpray-etricsmay — erewhay ethay umbersnay omecay omfray

cat /proc/loadavg      # 1.23 0.98 0.76 2/456 12345 — load + runnable + lastpid
cat /proc/meminfo      # the ledger — every kind of memory
cat /proc/vmstat       # the counters behind vmstat
cat /proc/stat         # cpu jiffies — what top computes from
cat /proc/net/dev      # per-interface bytes — what iftop reads

optay eadsray /ocpray/atstay + /ocpray/*/atstay; eefray eadsray /ocpray/eminfomay; iostatway eadsray /ocpray/iskstatsday — ethay onitoringmay oolstay areway eadersray, otnay ensorssay.

Imetay — ethay uietqay achinerymay

date                       # now
date -u                    # UTC
date +%s                   # epoch seconds — the real format
date -d @1700000000        # epoch → human
timedatectl                # the status — tz, NTP, sync state
timedatectl set-timezone America/Chicago
timedatectl set-ntp true   # enable NTP
hwclock --show             # the hardware clock — the other clock
hwclock --systohc          # system → hardware — save it
cal                        # the calendar
TZ=UTC date                # override the zone for one command

Otway ocksclay: ethay ardwarehay ockclay (Rtcay — urvivessay owerpay-offway) andway ethay ystemsay ockclay (ethay ernelkay'say, etsay atway ootbay). ockhwclay idgesbray emthay; Ntpay eepskay ystemsay imetay uetray. Imezonetay iveslay atway /etcway/ocaltimelay → /usrway/areshay/oneinfozay/Egionray/Itycay — away ymlinksay, angeablechay erpay-ocesspray iavay Tzay.

Ocalelay — ethay anguagelay ayerlay

locale                     # current settings
locale -a                  # available
localectl list-locales     # systemd's view
export LC_ALL=C            # the predictable POSIX mode — LFS's friend
export LANG=en_US.UTF-8    # the normal one
update-locale LANG=...     # Debian's setter

Lcay_ALLway=Cay/OSIXpay isway ethay eterministicday odemay — ortingsay, ollationcay, errorway essagesmay allway anonicalcay — ethay Lfsay uildsbay' eproducibilityray ackhay andway away ebuggingday ooltay (errorway essagesmay inway Englishway atchmay Ooglegay esultsray).

Eadingray away icksay ystemsay — ethay iagetray

  1. ournalctljay -pay errway -bay orway epgray -iway 'errorway\|ailfay' /arvay/oglay/essagesmay — ethay omplaintscay
  2. esgdmay -lay errway,arnway — ethay ernelkay'say
  3. optay/eefray/dfay -hay/dfay -iway — ethay esourcesray
  4. ssay -tlnpay — ethay urfacessay
  5. ournalctljay -uway <ailingfay> — ethay uspectsay'say orystay

Erewhay ogginglay oesgay ongwray

YmptomsayAusecay
ournalctljay eatsway igabytesgayYstemMaxUsesay/--acuumvay-izesay — imtray itway
Away oglay isway emptywayEthay aemonday evernay artedstay — ystemctlsay atusstay
Imestampstay ongwraytzay vsay Rtcay — imedatectltay owsshay ethay ivergenceday
Ogslay opstay idmay-ilefayOtationray — atzcay/esszlay ethay .gzay archivesway
"onay acespay eftlay" utbay iskday inefayinodeway exhaustionway — dfay -iway
Errorway inway anotherway anguagelayLcay_ALLway=Cay anonicalizescay

Exercisesway

  1. ournalctljay -bay -1 -pay errway — eadray away eviouspray ootbay'say ailuresfay.
  2. esgdmay -Tay | ailtay — ethay astlay ardwarehay eventsway.
  3. atchway -nay1 eefray -hay — atchway emorymay eathebray.
  4. imedatectltay — eesay othbay ocksclay' yncsay atestay.
  5. Lcay_ALLway=Cay lsay /onexistentnay vsay lsay /onexistentnay — ethay ocalelay ifferenceday.

Imelinetay

AyerlayEthay echanismmay
yslogsay/arvay/oglay exttay ilesfay
ournaldjayEthay inarybay indexedway oglay
esgdmayEthay ernelkay'say ingray ufferbay
onitoringmayoptay/atvmstay/iostatway
imetayRtcay + Ntpay + tzay
ocalelayLcay_ALLway + ANGlay

Eesay alsoway

Categories: Handbook · Linux · Linux Handbook
This page was last edited 2026-10-26 13:32:06 UTC by ALB Team. What links here