LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ps command gives only userid for certain users, not username (https://www.linuxquestions.org/questions/linux-newbie-8/ps-command-gives-only-userid-for-certain-users-not-username-591164/)

jkm13 10-11-2007 04:41 PM

ps command gives only userid for certain users, not username
 
This is driving me crazy. I've added two users today with "useradd -m <username>". All processes for the first user I added show up in "ps -elf" with the userid listed instead of the username. Processes for the second user show up as I would expect: with the username.

For the problematic user, when I do ps -eo "%u", the list includes the username but doing ps -eo "%u %c" causes it to display the userid with the command.

The entries in /etc/passwd and /etc/shadow seem right.

Tischbein 10-12-2007 09:30 AM

On my various boxes the full text field selectors seem the most reliable, e.g.:

Code:

> ps -eo "ruid ruser cpu %cpu"

  305 tegner    0  0.0
    0 root      0  0.4
    0 root      0  1.6

The full text versions are in the man page, have fun.

SlowCoder 10-12-2007 11:32 AM

How does
Code:

ps aux
work for you?

jkm13 10-30-2007 08:38 PM

Actually, the 'ps -eo "ruid ruser cpu %cpu" ' command still gives me just the uid #, like this:

[root@zen init.d]# ps -eo "ruid ruser cpu %cpu"
RUID RUSER CPU %CPU
25 named - 0.0
0 root - 0.0
0 root - 0.0
32 rpc - 0.0
29 rpcuser - 0.0
99 nobody - 0.0
0 root - 0.0
0 root - 0.0
0 root - 0.0
0 root - 0.0
27 mysql - 0.0
0 root - 0.0
51 smmsp - 0.0
0 root - 0.0
0 root - 0.0
0 root - 0.0
48 apache - 0.0
48 apache - 0.0
48 apache - 0.0
48 apache - 0.0
48 apache - 0.0
48 apache - 0.0
48 apache - 0.0
48 apache - 0.0
43 xfs - 0.0
0 root - 0.0
0 root - 0.0
81 dbus - 0.0
42 gdm - 0.0
0 root - 0.0
501 501 - 0.1
501 501 - 0.0
501 501 - 0.0
501 501 - 0.0
501 501 - 0.0
501 501 - 0.0
501 501 - 0.0
501 501 - 0.0
501 501 - 0.0
0 root - 0.0

(edited slightly to pull most root entries for easier reading).

The "ps aux" command gives the uid as well.


All times are GMT -5. The time now is 04:39 PM.