Getting list of pids and process names

By running ps aux I can get list running processes with command associated with them, e.g.

USER               PID  %CPU %MEM      VSZ    RSS   TT  STAT STARTED      TIME COMMAND
_windowserver      142   2.0  1.3  4559968 224672   ??  Ss    7:11AM  33:21.95 /System/Library/PrivateFrameworks/SkyLight.framework/Resources/WindowServer -daemon
lrogalsk          6419   1.9  0.5  2703580  77588   ??  S     2:15PM   0:40.88 /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal
...

Unfortunately, COMMAND includes command line arguments and absolute path of file, both of which may contain spaces. How can I get process name in deterministic manner?


Solution 1:

Apparently I'm blind.

 -c      Change the ``command'' column output to just contain the executable name, rather than the full
         command line.

ps auxc works just fine.

USER               PID  %CPU %MEM      VSZ    RSS   TT  STAT STARTED      TIME COMMAND
lrogalsk         18670  15.6  1.4  3913100 241624   ??  Ss   12:12PM   0:09.93 com.apple.WebKit.WebContent