If I run multiple programs with program & in one terminal, and then from another one start sending SIGKILL SIGINT or any other signal, will the terminal running all the processes tell me what process received what signal?


The terminal is not aware of the signals sent to such processes thus won't tell you anything. But if your shell has job control, it can tell you when a background job terminates (e.g. due to the signal). For instance, with bash and zsh, you need to setopt the notify option so that you get such a report immediately (instead of waiting for the next prompt).

You can also set up a SIGCHLD trap, which is executed when a background job terminates (but you won't be able to get any information on the terminated job with the trap).

In POSIX shells, you can also use wait $pid to get the exit status of some PID $pid (which will give you the signal, with possibly false positives and false negatives, depending on what the process does), with some limitations. See the wait specification for more information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.