LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   ps output (https://www.linuxquestions.org/questions/linux-general-1/ps-output-49305/)

mriolo 03-11-2003 01:17 PM

ps output
 
Can anyone tell me why sometimes the output of ps with -f displays the uid as the numerical id, and sometimes it displays the name?

Thanks,
Matt

(RH Adv Srv 2.1 - [7.2 kernel])

micxz 03-11-2003 01:57 PM

-f does full listing
f ASCII-art process hierarchy (forest)
--forest ASCII art process tree

try these:

ps -f
ps f
ps auxf

You will notice the difference.

Tinkster 03-11-2003 02:58 PM

Of course you can always try
man ps
for more indepth information ;)

Cheers,
Tink

mriolo 03-11-2003 04:14 PM

I guess the man pages might help if the output wasn't changing for the same command line syntax.... See below for specifics.

In these examples:
uid username
505 ggilman
506 ecummings
507 cmathews
508 hpriest
509 droche

Prior to reboot.....

#ps -fC pro
506 3452 3451 0 09:44 pts/28 00:00:00 pro UNK MEG
cmathews 3612 3611 0 10:16 pts/14 00:02:50 pro UNK MEG
506 3688 3687 0 10:19 pts/32 00:00:13 pro UNK MEG
hpriest 3741 3740 0 12:02 pts/8 00:00:47 pro UNK MEG
droche 3802 3801 0 12:27 pts/16 00:00:00 pro UNK MEG
ggilman 3810 3809 0 12:34 pts/10 00:00:00 pro UNK MEG

After rebooting.....

#ps -fC pro
ecummings 212 211 0 14:24 pts/3 00:00:00 pro UNK MEG
hpriest 244 243 0 14:30 pts/5 00:00:00 pro UNK MEG
509 253 252 0 14:33 pts/6 00:00:00 pro UNK MEG
507 260 259 0 14:35 pts/7 00:00:00 pro UNK MEG

It seems as though once linux determines, whether based on some reason or randomly, whether it will use the number or the name, it maintains it for that user consistently, at least while they are connected.

micxz 03-11-2003 04:31 PM

I now see your point. This is a very good question.

Tinkster 03-11-2003 05:27 PM

Ooops ... that *IS* a weird thing, I admit, never seen anything
like that before. Thanks for posting the output like that.

Seems like ps falls over in reading passwd properly there...

Cheers,
Tink

mriolo 03-12-2003 09:47 AM

The answer seems to be, that any usernames that are longer than 8 characters display by uid ....

Dark_Helmet 03-12-2003 10:31 AM

Well, according to the post-reboot output, "ecummings" was displayed and it is over 8 characters in length. Also, the second output did not print the username for ID 509: droche (which is less than 8)... Does anybody know where the source for ps is? If ever in doubt, the source will tell all... :)

mriolo 03-12-2003 10:35 AM

I didn't cut and paste the output - I retyped on one machine from the other, and substitued the usernames in myself - unscientific results ... spankin' for me.

Dark_Helmet 03-12-2003 10:58 AM

Hehehe... ok. I'll excuse it just this once... :)


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