So here's what I want to do: User inputs a USERNAME. Based on this username, I need to get the list of processes started by this user. I am planning to do this by getting the UID of this user and listing all the processes with this UID. I only found UID in the /proc/$PID/status file. I am unclear about how do I proceed with this.
How to get UID and PID
linux;process;proc
To get the UID from the username, use id -u:$ id -u root0$ id -u lightdm112$ id -u nobody 65534But you are re-inventing the wheel. pgrep already handles this just fine:$ pgrep -u www-data1909191019111912$ id -u www-data   33$ pgrep -u 33      1909191019111912You can also use plain ps:$ ps -U www-data -o uid,pid  UID   PID   33  1909   33  1910   33  1911   33  1912