Logging & Journald
See what happened since the last boot (and more)
đź§© The Challenge
You’ve just rebooted a server because something was acting up, and now you need to figure out what went wrong. Sifting through megabytes of old log entries that aren’t relevant to this boot cycle is a total waste of time, and honestly, super annoying.
đź’ˇ The Fix
There are simple `journalctl` flags to show you only the logs from the *current* boot, or even just the *last N minutes*. This saves you a ton of scrolling and helps you pinpoint fresh issues way faster.
journalctl -b 0
journalctl -b -1
journalctl -S "5 minutes ago"
journalctl -S "yesterday" -U "now"
⚙️ Why It Works
The `-b` flag is your best friend here, showing you logs by boot number. `0` is the current boot, `-1` is the previous. And `-S` lets you specify a start time, which combined with relative terms like “5 minutes ago” or “yesterday” is pure gold for quickly narrowing down events.
🚀 Pro-Tip: Use `journalctl -b -1 | less` to review what happened *just before* a crash and subsequent reboot.
Linux Tips & Tricks | © ngelinux.com | 9/24/2026
