Sunday, 18 March 2018

sigint - Less interrupting in less


I often pipe program output to less, e.g.


produce_output | less

This works great, until produce_output produces large amounts of output. If I search for some text that is deep into the file, less reports


Calculating line numbers... (interrupt to abort)

If I interrupt with Control+C, it also kills produce_output, which stops it from producing further output. Is there any way to send the interrupt to less, so that produce_output keeps running?


I know that I could use kill -INT less_process, but I think there must be a better solution.



Answer



Normally all processes in a pipeline run in the same process group, causing all of them to receive the signal. You can use setsid foo | less to run foo in a different pgrp.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...