Sample Header Ad - 728x90

Is there any way to exit “less” follow mode without stopping other processes in pipe?

16 votes
6 answers
10346 views
Often times I find myself in need to have the output in a buffer with all the features (scrolling, searching, shortcuts, ...) and I have grown accustomed to less. However, most of the commands I use generate output continuously. Using less with continuous output doesn't really work the way I expected. For instance: while sleep 0.5 do echo "$(cat /dev/urandom | tr -cd 'a-zA-Z0-9' | head -c 100)" done | less -R This causes less to capture the output until it reaches maximum terminal height and at this point everything stops (hopefully still accepting data), allowing me to use movement keys to scroll up and down. This is the desired effect. Strangely, when I catch-up with the generated content (usually with PgDn) it causes less to lock and follow new data, not allowing me to use movement keys until I terminate with ^C and stop the original command. This is not the desired effect. Am I using less incorrectly? Is there any other program that does what I wish? Is it possible to "unlock" from this mode? Thank you!
Asked by normalra (163 rep)
Apr 19, 2015, 09:08 AM
Last activity: Sep 10, 2024, 05:28 PM