linux ps查看进程显示的是用户ID而不是用户名是怎么回事?

用ps -ef | grep XXX 查看进程时候,第一列是UID,一般是显示用户名,但是我创建的用户显示的是 用户的id,是个数字,这是怎么回事?怎么配置

ps命令UID列默认只能显示8位(含8位)的用户名,超过8位就显示UID
但是ps可以自定义显示列的宽度,试一下:
ps -o ruser=useruser10 -e -o pid,ppid,c,stime,tty,time,cmd
UID列名被改为useruser10,这样就能显示10位的用户名了
温馨提示:内容为网友见解,仅供参考
第1个回答  推荐于2017-11-26
man ps可以看到NOTES里有
If the length of the username is greater than the length of the display column, the numeric user ID is displayed instead.

你的用户名长度超过8个字符了

要配置,就定制你的输出格式了,man ps都有详细解释
要学会用man本回答被提问者采纳
相似回答