54

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.

3 Answers 3

76

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!

5
  • Or pass --no-pager if you just want to see it and now have it stop. Commented Jun 17, 2021 at 22:54
  • 7
    Note that adding --pager-end seems to trim the output to 1000 latest lines. Commented Sep 2, 2022 at 8:18
  • @Osman-pasha is it trimmed or is that the size of your console buffer? Commented Jan 8, 2023 at 19:58
  • 1
    @Blaise it's trimmed by journalctl itself, as per man (see the text in the answer): Commented Jan 10, 2023 at 9:58
  • "G works beautifully, the log is just very long, so it's searching for a long time until it reaches the end." That's for sure! It takes like a minute to find the end of this file with this command. I bet this file is gigabytes in size. Commented Jun 26, 2023 at 5:34
9

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 

Limiting to a fixed number of lines and jumping straight to the end 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.

Going further

Here are some more examples, derived from @Stéphane Chazelas's comment below my answer:

# Show all lines (`-n all`) from today (`--since today`), jumping straight # to the end (`-e`) journalctl -e --since today -n all # Show all lines (`-n all`) since the last boot (`--boot`), jumping straight # to the end (`-e`) journalctl -e --boot -n all 
1
  • 1
    Or journalctl -e --since today -nall for today's logs only and jump to the end. Or journalctl -e -b -nall for logs since last boot and jump to the end. Commented Jun 23 at 12:38
8

No one mentioned :

journalctl -r 

Browse the journal in reverse

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.