How to stop a process in Terminal

73

12

Possible Duplicate:
Ending a process in unix instead of interrupting it

When I task in Terminal, such as ping blah.com, how do I then stop this task (other than closing the Terminal window. In Windows, you can Ctrl+Break pretty much any terminal based process, but I can't figure out the way to do it on the Mac.

AngryHacker

Posted 2010-02-02T18:04:58.860

Reputation: 14 731

Question was closed 2010-02-02T18:56:30.910

This was useful to me coming from Linux. I had no idea Ctrl+Break was what I needed on Windows :) – Jack O'Connor – 2015-10-28T14:18:30.860

Answers

86

Ctrl + C

Ctrl + C is a the standard *nix way of signaling a process to abort.

heavyd

Posted 2010-02-02T18:04:58.860

Reputation: 54 755

3My Mac just beeps at me when I try this. – Kyle Bridenstine – 2017-03-24T18:52:24.657

7Mr. Tea: are you using Command instead of Control? – Wizard of Kneup – 2017-05-01T09:40:58.760

@heavyd, Why does man use q instead of ctrlC to quit? What's the rationale? – Pacerier – 2017-08-16T00:13:36.517

@Pacerier, I can't really say why, you'd have to talk to the developers to figure that out. Processes can capture the Ctrl + C signal and do something else if they choose, but by default the behavior of Ctrl + C is abort the process. – heavyd – 2017-08-16T15:38:31.043

28

Try Ctrl + C. Also, Ctrl + Z might help if you want to suspend a process.

For further information, man kill.

If you're curious about the difference between suspend and terminate, this answer is a good starting point; the TL;DR version is, a suspended process can be resumed later and its execution can continue. A terminated (and killed) process will be gone.

lorenzog

Posted 2010-02-02T18:04:58.860

Reputation: 1 962