2005년 5월 20일 금요일

Unix ps명령에서 ID대신 UID가 뜨는 이유

ID가 9글자 이상이면 ps에서 ID 대신 UID를 보여준다.

소스 : http://procps.sourceforge.net/
FreeBSD에서 ps 소스 보기 : /usr/src/bin/ps/

이유 설명
http://procps.sourceforge.net/faq.html
Why do long usernames get printed as numbers?

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

댓글 없음:

댓글 쓰기