How do I kill a process which is running in bash – for example, suppose I open a file:
$ gedit file.txt
is there any way within the command prompt to close it? This example is fairly trivial, since I could just close the window, but it seems to come up a bit, particularly when I mistype commands.
Also is there any way to escape an executable which is running? This probably has the same solution, but I thought I’d ask anyway.
Thanks
To interrupt it, you can try pressing ctrl c to send a SIGINT. If it doesn’t stop it, you may try to kill it using
kill -9 <pid>, which sends a SIGKILL. The latter can’t be ignored/intercepted by the process itself (the one being killed).To move the active process to background, you can press ctrl z. The process is sent to background and you get back to the shell prompt. Use the
fgcommand to do the opposite.