Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the process user name by PID on Mac OS?

Tags:

shell

macos

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?

like image 876
user1198790 Avatar asked Feb 09 '12 04:02

user1198790


People also ask

How do I get the process name from PID?

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.

How do I find the process name on a Mac?

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.

How can I see the process PID?

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.


1 Answers

ps -ef | grep <process_pid> --- this will give you all the information you need.

like image 94
Bill Avatar answered Nov 06 '22 18:11

Bill