Did you know?
journalctl -b -1 shows the logs from before the last reboot.
The fastest way to find out why a server crashed or rebooted.
- System & services
- Last checked
Explained
When a machine rebooted unexpectedly, the interesting messages are in the previous boot. -b selects a boot: -b or -b 0 is the current one, -b -1 the one before, -b -2 the one before that.
journalctl -b -1 -p errjournalctl -b -1 -e
-p err shows only errors and worse; -e jumps to the end, where the last messages before the reboot are. List the boots the journal knows about:
journalctl --list-boots
This only works if the journal is persistent, that is, stored on disk in /var/log/journal. Without that directory, logs are kept in memory and lost at reboot. Ubuntu enables it by default. To enable it elsewhere:
sudo mkdir -p /var/log/journalsudo systemctl restart systemd-journald
Keep an eye on its size with journalctl --disk-usage.
Learn more
- How to Automate Journalctl Log Cleanup on Linux Full guide · Updated Apr 2025
-
journalctlcommand cheat sheet Options and copy-ready examples
