0

Can kill in bash only send a signal from the current shell process to a process group? That is the impression from the posts that I have had so far.

Can kill in bash send a signal only to a single process whose process group has other process(es)?

In Linux, is a signal always sent from a process or the kernel to a process group, instead of to a single process?

2
  • 2
    I'm not sure I understand you but you can kill a pid or a pgid which to me would indicate that it can in fact send signals to individual processes.
    – jesse_b
    Aug 10 '17 at 0:20
  • "In Linux, is a signal always sent from a process or the kernel to a process group, instead of to a single process?" FYI, this is a kernel question, not a bash question.
    – Wildcard
    Aug 10 '17 at 1:51
2

I created a do nothing script (from user6915 @ 42901) in order to get a few processes running under one pgid:

[root@JBCLAMP001 ~]# ps x -o "%r %p %y %x %c"
 PGID   PID TTY          TIME COMMAND
62102 62102 pts/8    00:00:00 bash
62102 62104 pts/8    00:00:00 cat
62102 62103 pts/8    00:00:00 bash

Then I killed 62104 (cat):

 PGID   PID TTY          TIME COMMAND
62102 62102 pts/8    00:00:00 bash
62102 64207 pts/8    00:00:00 cat
62102 64206 pts/8    00:00:00 bash

It restarted one of the bash processes but I think that was just the bash process that cat was running in? Either way it appears the parent bash process stayed open. Am I on the right track or is this not what you're asking?

1
  • 1
    Thanks. My impression (from seeing somewhere which I can't find now) was that kill sends a signal only to all the processes of a job, instead of a process in a job, or I messed up my memory with something else. A job is a process group managed by a shell. So I was thinking kill sends a signal only to all the processes of a process group.
    – Tim
    Aug 10 '17 at 0:56

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.