pythonic metaphor pythonic metaphor - 1 year ago 116
Linux Question

Sending SIGINT from keyboard to piped commands in bash

If in bash I run

a | b | c | d
on the command line and then press ^C, which process gets the signal?

Answer Source

In short, they all do.

When setting up a pipeline, the shell creates a process group. ^C is interpreted by the kernel's line discipline as the user's request to interrupt the process group currently running in the foreground. Sending a signal such as SIGINT to a process group automatically delivers the signal to all processes in the group.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download