How to show command of a process in activity monitor?

I want to see the exact commands of some processes in activity monitor, as most linux process monitor can do. Is it possible with activity monitor?


Solution 1:

Select desired process, click the gear button or the View menu, and then select Sample Process. The 5th line in the sample window shows the path to the executable.

Solution 2:

I could not find such functionality in the Activity Monitor, but we can use following bash command to get the same outcome:

ps -eo pid,ppid,%mem,%cpu,args -r | head

Sample output:

  PID  PPID %MEM  %CPU ARGS
  215     1  0.1  50.4 /usr/libexec/sysmond
81699 81694  2.4  27.8 node /Users/pongli/my/git/shroogal-dev2/node_modules/.bin/tsc -w
81662 81657  0.9  19.0 node /Users/pongli/my/git/V2ServiceApp/node_modules/.bin/tsc -w
81702 81700  0.3   6.9 gulp   
27827 27796  5.2   6.6 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS
76036 72939  0.0   5.3 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS
  217     1  0.9   3.3 /System/Library/PrivateFrameworks/SkyLight.framework/Resources/WindowServer -daemon
83975  1641  1.3   2.8 /Applications/Google Chrome.app/Contents/Versions/63.0.3239.84/Google Chrome Helper.app
36742  1641  8.1   2.2 /Applications/Google Chrome.app/Contents/Versions/63.0.3239.84/Google Chrome Helper.app

Solution 3:

Activity monitor doesn't allow you to display the exact command used to launch a process. You can use htop which display all command parameters and allows you to order processes in a tree. You can install htop with:

brew install htop

enter image description here