2

Is there any difference between ctrl+c and cmd+. when stopping a terminal process?

2 Answers 2

0

No there is no difference. They both send a SIGINT signal to the running process.

You can demonstrate this using the code sample from this answer: https://stackoverflow.com/a/9256709/4087178

1

They are exactly the same. ⌘ CMD+. sends SIGINT just like ⌃ CTRL+c. I've checked this with this python script:

#!/usr/bin/env python
import signal
import sys
def signal_handler(signal, frame):
    print('You pressed Ctrl+C!')
    sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
print('Press Ctrl+C')
signal.pause()

It's made this way for backward compatibility, earlier versions of Apple keyboards did not have ⌃ CTRL button. Please read Max Ried comment bellow.


code from: https://stackoverflow.com/a/1112350/3488699

4
  • What Apple keyboard did not have a Control key? I'm not aware of any.
    – bot47
    Jun 30, 2015 at 14:34
  • @MaxRied for example The Macintosh Plus Keyboard, check: en.wikipedia.org/wiki/Apple_Keyboard Jun 30, 2015 at 14:48
  • 1
    Wow, that's legacy... From my understanding the Command-key on Apple OSes was traditionally used to issue commands, while control-key was a modifier key to Enter control characters. Up to OSX, there was no commandline, which traditionally is controlled using control characters. Thus the easy to memorable CMD+. (Read "Command full stop") was used. With the xnu Backend of OSX, Apple added the traditional Ctrl-C (Read " Cancel") as a lot of software expected it. Besides: CMD+. to interrupt Command line tasks is Terminal.app specific.
    – bot47
    Jun 30, 2015 at 15:02
  • 1
    @MaxRied thanks for clarification. I've edited my post, so that future readers can see Your comment. Jun 30, 2015 at 15:06

You must log in to answer this question.

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