29

If I type sudo journalctl I get the system journal in some kind of a reader. Pressing j and k works like in Vi but G does not go to the end of the file. In fact, if press G, the stream freezes and I have forcibly terminate it.

No mention of using the reader is in the man page for journalctl.

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
Tyler Durden
  • 5,411
  • 16
  • 57
  • 96

2 Answers2

43

that "reader" is just less.

No mention of using the reader is in the man page for journalctl.

err, said man page:

The output is paged through `less` by default,

but:

but G does not go to the end of the file. In fact, if press G, the stream freezes and I have forcibly terminate it.

G works beautifully, the log is just very long, so it's searching for a long time until it reaches the end.

from the man page:

  -e, --pager-end
      Immediately jump to the end of the journal inside the implied pager 
      tool. This implies -n1000 to guarantee that the pager will not buffer 
      logs of unbounded size. This may be overridden with an explicit -n 
      with some other numeric value, while -nall will disable this cap. 
      Note that this option is only supported for the less(1) pager.

So,

journalctl -e

is what you want to run!

tanius
  • 864
  • 11
  • 10
Marcus Müller
  • 21,602
  • 2
  • 39
  • 54
0

Adding onto @Marcus Müller's excellent answer:

# show only the last 1000 lines of the systemd journal (`-n 1000` is implied),
# jumping straight to the end (`-e`)
journalctl -e

# same as above
journalctl -n 1000 -e

# same as above, except show the last 10000 lines instead of 1000 lines
journalctl -n 10000 -e

You can prove this is working by counting the lines. Run and output:

$ journalctl -n 10000 -e | wc -l
10020

This is soooo much faster than running journalctl directly, as my log is loooooooooong, and it takes like a full minute to read to the end of it otherwise.

Gabriel Staples
  • 2,192
  • 1
  • 24
  • 31