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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
02-17-2006, 06:09 AM
|
#1
|
Member
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383
Rep:
|
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
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?
|
|
|
02-18-2006, 03:39 PM
|
#2
|
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
|
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.
|
|
|
02-20-2006, 12:15 AM
|
#3
|
Member
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383
Original Poster
Rep:
|
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.
|
|
|
02-20-2006, 04:35 AM
|
#4
|
Senior Member
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,516
|
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.
|
|
|
02-20-2006, 08:21 AM
|
#5
|
Member
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383
Original Poster
Rep:
|
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;
}
|
|
|
02-20-2006, 08:40 AM
|
#6
|
Senior Member
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,516
|
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
|
|
|
02-20-2006, 09:17 AM
|
#7
|
Member
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383
Original Poster
Rep:
|
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
|
|
|
02-20-2006, 09:32 AM
|
#8
|
Senior Member
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,516
|
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
|
|
|
02-20-2006, 09:40 AM
|
#9
|
Moderator
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
|
"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)
|
|
|
02-20-2006, 09:45 AM
|
#10
|
Senior Member
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,516
|
I'm connecting to my solaris using an Exceed X server on a dos machine.
Maybe that throws it off.
|
|
|
02-20-2006, 09:52 AM
|
#11
|
Moderator
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
|
kshkid, can you post the "who -uH" output on your machine, and the PIDs it outputs that are confusing ?
|
|
|
02-20-2006, 01:59 PM
|
#12
|
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,326
|
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?
|
|
|
02-21-2006, 09:16 AM
|
#13
|
Member
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383
Original Poster
Rep:
|
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
|
|
|
02-21-2006, 10:37 AM
|
#14
|
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
|
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.
|
|
|
02-21-2006, 11:19 AM
|
#15
|
Moderator
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789
|
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 ...".
|
|
|
All times are GMT -5. The time now is 02:36 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|