Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've a bash script I use to run XCode on OSX, which takes several minutes. I can't find the key command to stop it if I realise an error... on DOS I'm used to CTRL+C/CTRL+Z but neither seems to work. What am i looking for (on the standard OS X terminal)?

share|improve this question
1  
ctrl C should send sig-term (this signal can be trapped), and ctrl z send sig stop (both (all) key sequences can be blocked.) You need to set keyboard focus to terminal first. (this comment is for any generic Unix system) – richard Sep 30 '12 at 19:40
    
@richard Ctrl-C sends SIGINT, not SIGTERM. SIGINT should terminate the process – Rich Homolka Oct 1 '12 at 18:27

There are a few keypresses that should help you here.

Ctrl-C should send the foreground process SIGINT, and that should terminate the process unless you trap the signal with something like trap INT ... in your shell code.

Ctrl-Z should send SIGSTOP, which would pause your process, again unless you trap your signals.

The mapping of key sequences jumps through some hoops, including terminal settings. What does stty -a say on your computer? Look in the output for intr, that's the keypress that should trigger SIGINT. If nothing is set, you need to set it, something like stty intr ^C

As others have said, you can kill the process from another window as well.

share|improve this answer

You can try these solutions :

  • try this keyboad combo : ctrl+altgr+8
  • open a new terminal and run pkill -f script_name
share|improve this answer
    
These are not applicable to OS X. – Gordon Davisson Sep 30 '12 at 20:49

If ctrl + C isn't working for you, you can open a new Terminal tab and type

killall [process name]

where [process name] is the name of your bash script (you can find this in OS X's Activity Monitor).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .