Knowledge

Linux signals: list

Send a short notice to a running program

A signal is a short notice the operating system can deliver to a running program. It can report an event or request an action, such as stopping or continuing. Most signals carry no extra message text, so they are not a general-purpose way to send data. Even when a program receives a signal, that does not guarantee it has finished cleaning up or saving its work.

In Bash, kill -l lists signal names known to the shell's built-in kill command. With no operand, it only lists names and sends nothing. Bash accepts a signal operand after -l, as in kill -l TERM, to query the shell's signal mapping. The external kill utility may support different conversions or formatting. Use help kill or the local manual when exact output matters.

These names appear often in shell use:

  • SIGINT is commonly generated when you press Ctrl+C in a terminal.
  • SIGTERM asks a process to terminate and is the usual default signal for kill.
  • SIGHUP began as a terminal-hangup signal; some programs also use it to request a reload.
  • SIGSTOP stops a process, and SIGCONT resumes it.
  • SIGKILL terminates a process without giving it a chance to handle the signal.

What happens depends on the signal and the receiving program. For most signals, a program can install a handler, ignore the signal, or block it temporarily. If it does none of those, the kernel applies the default action. SIGKILL and SIGSTOP cannot be caught, blocked, or ignored. Default actions include termination, stopping, continuing, or producing a core dump. Linux's signal(7) reference describes individual signals and their defaults.

Signal names are useful in scripts and documentation because numbers can mean different things across Unix-like systems and processor architectures. kill -l shows the names known to the active shell or utility. Its formatting is not a portable interface for another program to parse unless that implementation documents it.

A list teaches the names, but it cannot tell you whether a particular application handles a signal or what that handler does. Before sending SIGTERM, SIGHUP, or another signal to change an application's behavior, read that application's documentation. The signal reference describes operating-system defaults; programs can add behavior for signals they are allowed to catch.

Interactive exercises

Materials

Skillsets
Skillset Linux for backend developer preview
image descriptionLinux for backend developer
by Artem Naumenko (fb)
16 users
Skillset Linux administrator preview
image descriptionLinux administrator
by Infinite Education
3080 users
Skillset Devops preview
image descriptionDevops
by Ajay Kumar
2004 users
Skillset Devops preview
image descriptionDevops
by Dio
3 users
Do you know that ...?
Any useful or interesting facts about the skill. Any peace of information would be useful