Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

emacs

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?

Update

Step-by-step:

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.

like image 484
Marius Hofert Avatar asked Jan 20 '12 18:01

Marius Hofert


1 Answers

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.

like image 162
Sean Avatar answered Oct 14 '22 22:10

Sean