When using the ps command, it is found that some users display the user name, and some users display the UID, such as the webmaster when the nmon program is running, but ps does not directly display uid 500
Found through man: Accounts with 8-digit usernames can display the complete username, and accounts with 9-digit usernames display UID
Use the following commands to solve;
ps -o ruser=userForLongName -e -o pid,ppid,c,stime,tty,time,cmd
Note: "userForLongName" is filled in casually, Linux will automatically check the length of this string, which is 15, then user names with less than 15 characters can be displayed normally
Now run the ps command result;
The above is the detailed content of How to fix ps command showing UID instead of username. For more information, please follow other related articles on the PHP Chinese website!