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:
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:
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 ontty[1-6]
to kill something - a remote connection through
ssh
, therefore is possible usepkill
based onpts/[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
?