ssh remotehost "remote_command" | more
This executes remote_command
on remotehost
, and paginates the output of remote_command
. If the user is unwilling to scroll through all the pages, he might press q
at the --MORE--
prompt. Unfortunately this doesn't stop the ssh process (and the remote command). The user have to press ^C
to actually terminate the processes. When user presses q
more terminates and ssh gets SIGPIPE but continues as remote_command
didn't finish executing. Is there any way I can terminate ssh and remote execution when the user quits the pager? I don't want the user to press ^C as he wouldn't be required to do so if a local file was being catted (in fact he wouldn't know this command is being executed over a ssh tunnel remotely).