0

I'd like to use journalctl -f and pass that content into less for the following reasons:

  • Horizontal scrolling for long lines (instead of line wrapping)
  • Easy vertical scrolling

So less works fine with static content (like a file or terminated streaming data), but can it also work with unterminated streaming data?

I'm looking for something like this:

journalctl -f | less -???

If I try this now, less will wait and not show any data until I press Ctrl+C, then it will show an empty file.

Edit: This is not about tail -f – tail can only read files from disk, not streaming data piped in from stdin.

Edit2: It's not just about journalctl alone. I'm using JSON output with -o json and pretty-print that using jq. This will be part of the pipeline, but was left out for simplicity of this question. If I can stream anything into less, I can also insert a formatter into the pipeline.

3
  • see unix.stackexchange.com/questions/229188/… Commented Nov 29, 2019 at 20:39
  • Have you tried typing G? Commented Nov 30, 2019 at 16:59
  • G jumps to the end of the file. But in streaming, there is no end of a file, there isn't even a less because it's still sitting there waiting for the end of the stream that never happens because new data can arrive any time.
    – ygoe
    Commented Nov 30, 2019 at 21:11

0

You must log in to answer this question.

Browse other questions tagged .