How to use the journalctl Linux command

Learn about the Linux command which can help you troubleshoot why apps and services fail to start.

Boot entries

If you want to list out only the boot process and how services fared during the booting of the system, issue the command:

$ journalctl -b

Say you want to see the journal output of the previous boot. If the current boot is 0, the previous boot would be -1. That command would be:

$ journalctl -b -1

The boot prior to that would be:

$ journalctl -b -2

Continue on like that, until you find the boot journal you’re looking for. That is a very handy way to compare your current boot (one that might have issues) to a previous boot instance where certain services failed to start.

If you’re not sure how many boots the system has experienced, issue the command:

$ journalctl --list-boots

Viewing by time

You can also use journalctl to view log entries by time. Say, for instance, you know an issue occurred within the last hour. To view all entries within that time frame, issue the command:

$ journalctl --since "1 hour ago"

Viewing by service (unit)

If you know of a service that’s having issues, you don’t have to worry about combing through the entire journal entry. For instance, if OpenNMS isn’t starting, issue the command:

$ journalctl -u opennms.service