Ok so here's a linux question that's been bugging me for years.
I sometimes less to display/paginate a streaming stdout from another program. When I press END key on the keyboard, it brings me to the bottom of the stream, the latest data it has.
Then it says "Waiting for data... (^X or interrupt to abort)"
I want it to stop waiting for data and let me scroll up as it usually does when it's not waiting for data.
@kuba „END“ key? Sounds weird. Try F (uppercase) and it will keep following the output dumping it into your terminal. Type CTRL-c to stop it following, now you can page normally through what came in so far. At any time press F again to have it follow and display incoming data.
"When the "Waiting for data" message is displayed, such as while in the F command, pressing ^X will stop less from waiting and return to a prompt. This may cause less to think that the file ends at the current position, so it may be necessary to use the R or F command to see more data."
@kuba I also need to know the answer to this. Sometimes I will work around this by dumping the output to a file in the background. And then doing less on that file.
@kuba you're doing the right thing! Or at least you're doing what should produce the result you want according to the default configuration of less(1).
However you say you're invoking less "indirectly" with journalctl; do you mean you're running journalctl ... | less, or just running journalctl and letting it invoke less(1) itself as the default pager? If the latter, it's useful to know that systemd invokes less with some quite non-default options!
@kuba If you consult the systemd documentation and the entries for $SYSTEMD_PAGER and $SYSTEMD_LESS¹ you'll find mention of some mysterious less(1) options but not what they mean or why they matter; but if you peek at the doc source code² you'll find that the behaviour you're describing is controlled by the presence of "K" in the default $SYSTEMD_LESS var, and you can override that out with, e.g.:
@kuba fantastic!! You're welcome! Thanks for giving me an opportunity to learn about this particular little stumbling block. I'll remember it for next time!!
Correct. Ehen you use less normaly Capital F start reading new content at the end. In a bash session i can you CTRL+C stop/interrupt the mode back to the previous mode - not Endung less...