25

In Linux terminal if I run a command like:

$ node httserver.js

The command runs and by doing ctrl + c the program is terminated and new line comes in terminal for us to enter a command.

I felt ctrl + c as the macOS terminal keyboard combo to do that but it doesn’t work.

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
Sagi_Avinash_Varma
  • 351
  • 1
  • 3
  • 4
  • 1
    Possible duplicate of [How to stop a process in Terminal](https://superuser.com/questions/103909/how-to-stop-a-process-in-terminal) – Giacomo1968 Oct 28 '19 at 03:09

6 Answers6

45

The accurate answer for MAC Keyboard on terminal is:

Command + . (dot/period)

This is equivalent to Ctrl + C or break.

Refer to the:

Terminal Help > Keyboard Shortcuts > Other Shortcuts > Break

The Control or Ctrl key is not a regular modifier in macOS.

However, if you are using a regular Windows keyboard with macOS then Ctrl + C works since there is no Command key in this case.

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
  • confirmed, other answers seem to be confused. Command+. works in OS X (Mac) Terminal application for sending an interrupt with a Mac keyboard. Control+C, Control+Z, Shift+Command+C, kill commands do not work in this setting. you cannot send a kill command while another command is actively running. – Brian D Oct 15 '20 at 22:25
10

Try:

Ctrl + C

It should be the same as Linux.

Duplicate of: this question

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
Dan Smith
  • 633
  • 4
  • 10
7

Try Ctrl + Z

Or you can use kill Command. For further information see man kill command for manual of kill command and you can get some guidance from this link about how to use kill command.

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
Chaitanya
  • 91
  • 4
  • ctrl-z does NOT do this. And "Or you can use the kill command" does not make any sense. Ctrl-Z and kill are completely and utterly different. I dont think you know what Ctrl-z does – Jay Day Zee Jun 15 '22 at 18:19
  • I found this worked in visual studio for mac terminal session – Rob Bowman Feb 08 '23 at 07:51
3

Try Shift + Command + C worked for a friend.

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
1

If you are using iterm2, you might need to look into Preferences -> Keys -> Remap Modifiers. In my case, control (^) was mapped to something else by default. After mapping it to control (^), the shortcut worked.

LyteFM
  • 111
  • 2
0

Typing Ctrl + h took me to a help thing where it showed me the letter to type to exit. In my case, it indicated I had to use Ctrl + q.

clmpt
  • 1