SIGINT Signal Explained (Signal 2)

What the Linux SIGINT signal does and when it's used.

Published October 23, 2026

SIGINT (signal 2) is the interrupt signal sent to the foreground process when you press Ctrl+C in a terminal. Programs usually stop, but can catch it to clean up.

What it does

Default action: Terminate. It can be caught with a signal handler.

Typically sent by: Ctrl+C or kill -INT PID. List all signals with kill -l.

Signal number and delivery

kill -l | grep SIGINT
2) SIGINT
kill -2 1234 # or kill -INT 1234
(signal delivered to process 1234)

Practical examples

Send it from the shell

kill -2 <PID>
kill -SIGINT <PID>
pkill -2 nginx

Handle it in a script

trap 'echo got SIGINT; cleanup; exit' SIGINT
while true; do sleep 1; done

Handle it in code

import signal, sys
def handler(sig, frame):
    print('received', sig)
    sys.exit(0)
signal.signal(signal.SIGINT, handler)

Common mistakes

  • Using kill -9 before trying SIGTERM.
  • Forgetting to find the right PID (ps aux | grep, pgrep).
  • Not handling signals in long-running services.

Key takeaways

  • SIGINT is signal 2.
  • Default: Terminate.
  • Use kill -l to list all signals.

FAQ

How do I handle Ctrl+C gracefully?

Register a SIGINT handler that closes resources and then exits.

How do I list all signals?

Run kill -l.

More Linux articles