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.
less
because it's still sitting there waiting for the end of the stream that never happens because new data can arrive any time.