Junior — Middle
Can you list the types of signals used in Linux and explain their purposes?
sobes.tech AI
Answer from AI
In Linux, signals are a way of asynchronously notifying processes about events. Here are the main types of signals and their purposes:
- SIGINT (2) — interrupt the process (usually Ctrl+C in the terminal).
- SIGTERM (15) — request for the process to terminate gracefully.
- SIGKILL (9) — immediately terminate the process (cannot be caught or ignored).
- SIGSTOP (19) — suspend the process (cannot be caught).
- SIGCONT (18) — continue a suspended process.
- SIGHUP (1) — hangup signal, often used to reload configuration.
- SIGQUIT (3) — quit with a core dump.
- SIGALRM (14) — timer signal.
- SIGUSR1 and SIGUSR2 (10 and 12) — user-defined signals for arbitrary purposes.
Each signal has a number and a default action, but processes can catch most signals to perform special handlers.