LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-17-2006, 05:09 AM   #1
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Rep: Reputation: 30
who - man pages


Hi All,

When I went through the man pages of who regarding the listing of PID's

the PID displayed is the pid of the user's current shell

Code:
who -uH
When I tried that on solaris,
only the PID of the login program which spawned the users-shell is displayed and not the pid of users-shell

This is really confusing.

Could you please explain it?
 
Old 02-18-2006, 02:39 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Can't answer that but if you want to see all processes owned by a specific user you can type:

ps -fu<username>

If you want to see all processes associated with a certain terminal (tty/pty) type:
ps -ft<terminal>

Either of the above will show you the user's shell and all other processes for that user (in case of username) or on that user's terminal (in the case of terminal).

The reason you might want to use the latter is that the user may have multiple logins and you may only be interested in what one of those logins is doing. Also this will let you see if the user has changed users with the su command as the process for the switched user will still be associated with the terminal.
 
Old 02-19-2006, 11:15 PM   #3
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Original Poster
Rep: Reputation: 30
thanks for the reply,

but I am afraid the answer you had posted is no where thinking of question that I had posted.

My intention is not about listing of process.
I would just like to clarify regarding the statement in the
man pages of who and
the output generated

I hope am clear with the question once again.
 
Old 02-20-2006, 03:35 AM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
Works ok-ish for me on solaris.
comes up with -ksh and FvwmConsole

that's who for you though. It never does what you want.
 
Old 02-20-2006, 07:21 AM   #5
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Original Poster
Rep: Reputation: 30
tried for the same reading the UTMP structure
but still the same output

could somebody please try the same on their sun boxes?
and please point me if I am wrong in my code.
Code:
# include<utmpx.h>

int main()
{
  struct utmpx *obj;
  setutxent();
  while( (obj=(struct utmpx *)getutxent()) != NULL )
  {
     (void) printf("USER: %s PID:%d\n", obj->ut_user, obj->ut_pid);
  }
  return 0;
}
 
Old 02-20-2006, 07:40 AM   #6
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
here's my output.
SunOS primadtpdev 5.8 Generic_108528-20 sun4u sparc SUNW,Ultra-250

Code:
billym.primadtpdev>1
USER:  PID:0
USER:  PID:0
USER: rc2 PID:61
USER: rc3 PID:283
USER: sac PID:368
USER: LOGIN PID:369
USER: zsmon PID:376
USER: LOGIN PID:387
USER: billym PID:15825
USER: billym PID:6724
USER: billym PID:10182
USER: billym PID:15846
USER: billym PID:15872
USER: bdsuser PID:16139
USER: billym PID:16288
USER: billym PID:17178
USER: billym PID:17188
USER: billym PID:24488
USER: billym PID:24517
USER: bdsuser PID:28615
USER: billym PID:11194
USER: bdsuser PID:5127
USER: billym PID:4152
USER: billym PID:4161
USER: billym PID:736
USER: billym PID:10235
USER: billym PID:8500
USER: billym PID:24145
USER: billym PID:4777
USER: billym PID:24197
USER: billym PID:25086
USER: root PID:25393
USER: billym PID:25610
USER: billym PID:4330
USER: billym PID:4333
USER: billym PID:4336
USER: billym PID:4339
USER: billym PID:4342
USER: billym PID:4351
USER: billym PID:4354
USER: billym PID:4357
USER: billym PID:4368
USER: billym PID:4374
USER: billym PID:4377
USER: billym PID:4380
USER: billym PID:4383
 
Old 02-20-2006, 08:17 AM   #7
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Original Poster
Rep: Reputation: 30
thanks bigearsbilly,

but it would have been great and helpful
if you could please post the discription of the PID's listed
whether they are PID's of the login program or that of the shell's
 
Old 02-20-2006, 08:32 AM   #8
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
a bit like this:

Code:
billym.primadtpdev>1 | cut -f3 -d:|xargs -n1 ps -fp|sort -u
     UID   PID  PPID  C    STIME TTY      TIME CMD
    root     0     0  0   Jan 03 ?        0:01 sched
    root   368     1  0   Jan 03 ?        0:00 /usr/lib/saf/sac -t 300
    root   369     1  0   Jan 03 console  0:00 /usr/lib/saf/ttymon -g -h -p primadtpdev console login:  -T sun -d /dev/console
    root   376   368  0   Jan 03 ?        0:00 /usr/lib/saf/ttymon
    root   387   309  0   Jan 03 ?        0:00 /usr/dt/bin/dtlogin -daemon
  billym 15846 15845  0 09:06:25 pts/5    0:01 -ksh
  billym 15872 15871  0 09:11:59 pts/6    0:00 /usr/local/libexec/fvwm/2.4.19/FvwmConsoleC
  billym 16288 16286  0 11:25:27 pts/8    0:00 /usr/bin/rlogin primaappliv
  billym 17178 17176  0 13:18:47 pts/9    0:00 /usr/bin/rlogin primadtpliv
  billym 17188 17186  0 13:19:06 pts/10   0:00 /usr/bin/rlogin primadtpliv
 bdsuser 16139 16138  0 10:40:14 pts/7    0:00 -ksh
 
Old 02-20-2006, 08:40 AM   #9
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
"who -uH" on Solaris is correctly giving me the logged users shell's pids.
Code:
NAME       LINE         TIME          IDLE    PID  COMMENTS
jlliagre   console      Feb 20 11:09  0:37    326
jlliagre   pts/1        Feb 20 11:24  1:19    972       (:0.0)
jlliagre   pts/2        Feb 20 11:34  0:10    999       (:0.0)
guest      pts/6        Feb 20 15:40   .     2197       (localhost)
 
Old 02-20-2006, 08:45 AM   #10
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
I'm connecting to my solaris using an Exceed X server on a dos machine.
Maybe that throws it off.
 
Old 02-20-2006, 08:52 AM   #11
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
kshkid, can you post the "who -uH" output on your machine, and the PIDs it outputs that are confusing ?
 
Old 02-20-2006, 12:59 PM   #12
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
Quote:
Originally Posted by bigearsbilly
I'm connecting to my solaris using an Exceed X server on a dos machine.
Maybe that throws it off.
i hate humingbird exceed (too bloaty) why dont you like putty?

sorry this isnt related.

but i sometimes see difeernces in the rows returned by w and who. maybe w does what you are expecting?
 
Old 02-21-2006, 08:16 AM   #13
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Original Poster
Rep: Reputation: 30
here is the output

Code:
NAME       LINE         TIME          IDLE    PID  COMMENTS
kshk     pts/24       Feb 20 05:18   .    28956       (105.7.4.10)
Code:
root 28956 28953  0   Feb 20 pts/24   0:00 login -p -d /dev/pts/24 -h 105.7.4.10
and the process id of the shell,
28957
 
Old 02-21-2006, 09:37 AM   #14
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
i hate humingbird exceed (too bloaty) why dont you like putty?
PuTTY is for doing ssh connections. Exceed is for displaying X Windows connections.

You're correct for terminals there's not a lot of difference. However you can initiate the session from the server side on an X Window and also give it tons more options than you can a standard PuTTY window. However I mainly use Exceed for a lot of the other X Windows one has from Unix/Linux. I wouldn't be able to display a browser from my Linux workstation to my Windows through PuTTY but can with Exceed. A lot of the admin tools on HP-UX (which are superior to Solaris' hodge-podge of tools IHMO) have both a text based and GUI version and generally like using the latter.
 
Old 02-21-2006, 10:19 AM   #15
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Can you give the full process stack of this process (pstack 28956), I suspect the command is launched by something like "xterm -e login -p ...".
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C man pages sono2 Programming 4 09-12-2005 01:24 AM
C man pages sono2 Linux - Software 2 09-09-2005 12:24 PM
Man pages twantrd Solaris / OpenSolaris 5 08-16-2004 03:15 AM
How do I know where the man pages are? narik Linux - General 1 06-15-2004 01:22 PM
man pages spuppett Linux - General 5 02-23-2003 02:28 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration