How to kill a remote process without killing the shell (C-C C-c also kills the shell & hellip;)


Assume you work on a remote server from a local emacs shell (started with M-x shell). If you execute a process which takes too long (for example an ls in a directory with a huge amount of files), you would like to stop that process (in the terminal one would use control-c). I tried C-c C-c but that kills the whole shell... How can I only kill the running process on the remote server and not the whole shell?



1) M-x shell (execute on local machine)
2) ssh [email protected] (execute on local machine)
3) sleep 60 (execute on remote machine)
4) C-c C-c (execute in the current shell)

=> instead of still being on the remote host and just the sleep command being killed, the whole remote connection is closed and you are on your local machine again.

When I follow the steps you listed, I find myself back at the remote shell prompt. I'm using Emacs 23.1.1.

I find that typing C-q C-c RET also interrupts the remote process, again leaving me at the remote shell prompt. You might try that as an alternate approach.