How to see the last X lines with journalctl
How to limit the number of lines with journalctl?
Use the journalctl command and filter the number of entries by using the -n option. This will show only the specified number of lines.
journalctl -u UNIT -n NUMBERSometimes a systemd unit, like a service, should not be starting during boot time or not at all. Let’s have a look how to disable a systemd unit.
See the last few lines
By default, journalctl will display all entries from the journal. To limit this to last X lines, use the -n option and optionally define a number (default: 10 lines).
journalctl -n 5
Limit the output for a service
Combine the number of lines and specify a unit to see more relevant entries.
journalctl -u ssh.service -n 20
Tip: if you query the status output with systemctl, it will also pull the last ten lines from the journal (similar to -n 10).