Have your ever faced such a situation. You have usernames in your /etc/passwd file with more than 8 characters. This is no problem for Linux at all, usernames may be up to 32 characters long, only your ps output might look a little scrambled.
It shows you the uid instead of the username like in the following example:
|
1
2
3
4
5
6
7
8
9
|
$ iduid=20001(longuser01) gid=10002(oinstall) groups=10002(oinstall)$ sleep 1000000 &$ ps -ef | grep sleep | grep -v grep20001 14069 11739 0 14:11 pts/0 00:00:00 sleep 1000000 |
But you want to see the username instead of the uid. The workaround is
You could use the following alias to get the job done.
|
1
2
3
4
5
|
$ alias psx='export PS_FORMAT="user:12,pid,%cpu,%mem,vsz,rss,tty,stat,start,time,command"; ps ax'$ psx | grep sleep | grep -v greplonguser01 14069 0.0 58940 520 pts/0 S 14:11:50 sleep 1000000 |
Now it looks better.
Article Number: 328
Posted: Wed, Jul 25, 2018 1:53 PM
Last Updated: Wed, Jul 25, 2018 1:53 PM
Online URL: http://kb.ictbanking.net/article.php?id=328