Sample Header Ad - 728x90

What does Session ID mean within the pkill context?

2 votes
1 answer
2188 views
About the pkill command, I know is possible kill processes - for _specific scenarios_ - based through tty[1-6] and pts/[0-N]. I tested and works as expected. Until here all is ok. But now, according with this answer and solution: * [What is the difference between kill , pkill and killall?](https://unix.stackexchange.com/a/252360/383045) it indicates (extraction): >pkill and killall are also wrappers to the kill system call, (actually, to the libc library which directly invokes the system call), but can determine the PIDs for you, based on things like, process name, owner of the process, **session id**, etc. Observe the _session id_ part. I did do check both man and only exists this feature for pkill according with any of: * [pkill from commandlinux.com](https://www.commandlinux.com/man-page/man1/pkill.1.html) * [pkill from linux.die.net](https://linux.die.net/man/1/pkill) as follows respectively: -s sid,... Only match processes whose process session ID is listed. Session ID 0 is translated into pgrep's or pkill's own session ID. -s, --session sid,... Only match processes whose process session ID is listed. Session ID 0 is translated into pgrep's or pkill's own session ID. As you can see the content is the same with a minor variation in the options/parameters names. If I use: * directly the console, therefore is possible use pkill based on tty[1-6] to kill something * a remote connection through ssh, therefore is possible use pkill based on pts/[0-N] to kill something. The reason of this post: **Question** * What does _Session ID_ mean within the pkill context? **Extra Questions** * How was a _Session ID_ created? * How to know/retrieve a list of _Sessions ID_ to be used for pkill?
Asked by Manuel Jordan (2108 rep)
May 3, 2022, 12:29 AM
Last activity: May 3, 2022, 04:35 AM