I used getpid()
to know the process PID, and now how can I get the process user name?
I tried this shell command, ps -o user= PIDNUM
, but on Mac 10.4, it doesn't work for me.
Are there any other methods?
In this quick article, we've explored how to get the name and the command line of a given PID in the Linux command line. The ps -p <PID> command is pretty straightforward to get the process information of a PID. Alternatively, we can also access the special /proc/PID directory to retrieve process information.
Alternatively, navigate to the Utilities folder in Applications and double-click Terminal. View processes. When Terminal has launched, type "top" into the Terminal window. You'll see a list of currently running processes.
Task Manager can be opened in a number of ways, but the simplest is to select Ctrl+Alt+Delete, and then select Task Manager. In Windows, first click More details to expand the information displayed. From the Processes tab, select Details to see the process ID listed in the PID column.
ps -ef | grep <process_pid>
--- this will give you all the information you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With