-1

As far as I know, linux kenerl has sessions and process groups concept, I want to see the sessions and groups, what should I do?

1

You can use this command

 ps xao pid,ppid,pgid,sid,comm | less
 PID  PPID  PGID   SID COMMAND
    1     0     1     1 systemd
    2     0     0     0 kthreadd
    3     2     0     0 ksoftirqd/0
    5     2     0     0 kworker/0:0H
    6     2     0     0 kworker/u64:0
    8     2     0     0 migration/0


. . . . 
. . . . 
. . . . 
. . . . 

hit enter to see the next line

PID -  Process ID
PPID - Parent Process ID
PGIF - process group ID
SID - Session ID

for more check ps man

If you would like to check specific PID then use this command:

ps xao pid,ppid,pgid,sid,comm | grep <PID>

or

ps p <PID> o pid,ppid,pgid,sid,comm
  • 1
    or, for a specific pid without grepping: ps p PID o pid,ppid,pgid,sid,comm – Jeff Schaller Oct 1 '18 at 16:52
  • @ Jeff Schaller very nice!! i will include it in the answer ;-) – user88036 Oct 1 '18 at 16:54
  • It doesn't seem to group my processes by session, but just tell me SID and PGID – 炸鱼薯条德里克 Oct 3 '18 at 0:38
  • What do you mean by It doesn't seem to group my processes by session? – user88036 Oct 3 '18 at 0:41

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.