LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-11-2007, 05:41 PM   #1
jkm13
LQ Newbie
 
Registered: Oct 2007
Posts: 2

Rep: Reputation: 0
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.
 
Old 10-12-2007, 10:30 AM   #2
Tischbein
Member
 
Registered: Oct 2006
Distribution: debian
Posts: 124

Rep: Reputation: 15
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.
 
Old 10-12-2007, 12:32 PM   #3
SlowCoder
Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Fedora (Desktop), CentOS (Server), Knoppix (Diags)
Posts: 934

Rep: Reputation: 38
How does
Code:
ps aux
work for you?
 
Old 10-30-2007, 09:38 PM   #4
jkm13
LQ Newbie
 
Registered: Oct 2007
Posts: 2

Original Poster
Rep: Reputation: 0
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.
 
  


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
return the username in a command matthewhardwick Linux - General 6 10-12-2007 07:30 AM
how to get my username from command shell helptonewbie Linux - Newbie 20 10-12-2007 05:51 AM
Allowing multiple users with shared userid to have different filesystem permissions pcardout Linux - Security 11 05-11-2006 06:24 PM
other users' websites (~username) stlshawn Linux - Networking 4 12-26-2004 09:42 AM
command line to set a password to a new userid myhato Linux - Security 3 08-20-2004 12:46 AM


All times are GMT -5. The time now is 03:11 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration