[Solved] Stopping a runaway bash script

Asked by Julianloui on 2014-09-19


I would like to know how to stop a running bash script quickly. I find it annoying not being able to cancel a running show-and tell script I've written, which is based on espeak and shotwell. I've tried ctl+c, ctl+x and some terminal commands to no avail.

Any help will be much appreciated.


Question information

English Edit question
Ubuntu gparted Edit question
No assignee Edit question
Solved by:
Thomas Krüger
Last query:
Last reply:
Revision history for this message
Best Thomas Krüger (thkrueger) said :

If you can not stop a script with ^C you wtill have the option to "kill" it.
Open the Terminal, get a list of the running processes for example with

ps ax

find out the PID of the script.
Then run

kill PID

with the PID you founf out of cause. If the script is really stuck you can add the parmeter -9:

kill -9 PID

If the script is run by an other user you have to prefix the command with "sudo ":

sudo kill -9 PID

There is also "killall" which kills all processes what match an expression. See "man killall" for details.

Revision history for this message
Julianloui (julianloui) said :


Thank you very much for a powerful solution. I've just tried out 'ps ax' in Linux mint 17 to find the PID of a running script and it worked. I wish Linux Mint would allow the user to use Alt+Ctl+T to open a new terminal.


Revision history for this message
Julianloui (julianloui) said :

Thanks Thomas Krüger, that solved my question.