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.

ygoe
  • 223
  • 2
  • 13
  • see https://unix.stackexchange.com/questions/229188/journalctl-how-to-prevent-text-from-truncating-in-terminal – Valentin Bajrami Nov 29 '19 at 20:39
  • Have you tried typing G? – stolenmoment Nov 30 '19 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 Nov 30 '19 at 21:11

0 Answers0