bdubbs at swbell.net
Thu Apr 21 10:26:32 PDT 2005
Bruce Dubbs wrote:
> I just did an experiment. I created a user 'averylongname' and ps does
> indeed change this to a number, but ls -l adjusts the column width to
> accomodate the long name. Investigating...
Investiation complete. The following comment is in the procps source at
line 1018 of ps/output.c:
// The Open Group Base Specifications Issue 6 (IEEE Std 1003.1, 2004
// requires that user and group names print as decimal numbers if there is
// not enough room in the column, so tough luck if you don't like it.
// The UNIX and POSIX way to change column width is to rename it:
// ps -o pid,user=CumbersomeUserNames -o comm
// The easy way is to directly specify the desired width:
// ps -o pid,user:19,comm
There are a few ways to handle this:
1. Live with it. :)
2. Create an alias for the ps format you want to use and specify a
column width you want to use for UID.
3. Specify a format using the PS_FORMAT environment variable.
4. Hack the source. Adding the following code at line 1037 of
(outbuf+max_rightward) = 0;
More information about the blfs-dev