Common signals that can be caught using the trap command in Bash include:
- SIGINT (2): Triggered by pressing Ctrl+C; used to interrupt a running process.
- SIGTERM (15): The default termination signal; used to request a process to terminate.
- SIGHUP (1): Sent when the terminal is closed; often used to indicate that a session has ended.
- SIGQUIT (3): Triggered by pressing Ctrl+; used to quit a process and generate a core dump.
- SIGKILL (9): Cannot be caught or ignored; used to forcefully terminate a process.
- SIGUSR1 and SIGUSR2 (10 and 12): User-defined signals that can be used for custom purposes.
- SIGALRM (14): Sent when a timer set by the
alarmcommand expires.
You can specify these signals in the trap command to define custom actions when they are received.
