Wuhai’s Weblog

July 9, 2009

For ps output, why do long usernames get printed as numbers

Filed under: Linux — wuhai @ 5:16 am

I hit this issue recently, and it turns out to be in FAQ from procps:

Reference: http://procps.sourceforge.net/faq.html

The UNIX and POSIX standards require that user names and group names be printed as decimal integers when there is not enough room in the column. Truncating the names, besides being a violation of the standard, would lead to confusion between names like MichelleRichards and MichelleRichardson. The UNIX and POSIX way to change column width is to rename the column:

ps -o pid,user=CumbersomeUserNames -o comm

The easy way is to directly specify the desired width:

ps -o pid,user:19,comm

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.