ps axww -o command

This command gives me the "command" used to run the process. It also includes the "path" to the executable. I need ONLY the path. The problem is it also includes arguments with the path. I don't want the arguments.

example without args (This one is good)


example with args (This one isn't because it has --type=utility at the end)

/Applications/Google Chrome.app/Contents/Versions/.*.****.*/Google Chrome Helper.app/Contents/MacOS/Google Chrome Helper --type=utility

I know I can use | cut to cut the args like this

ps axww -o command | cut -f1 -d"-"

But now I'm having to add a ton of cuts to keep up with all the different switches on the different commands.


ps axww -o command | cut -f1 -d"-" | cut -f1 -d"("

and so on. Is there a way to get the full file path of all currently running processes and not this hack of showing the "command" which just happens to include the path?

  • ucomm just gives me the name of the process, not its location. – Stuart Sloan Feb 21 '19 at 17:57
  • Yes ps -ax -o comm gives me a list of all process names but not their full path location. ps -ax -o comm is also truncated to 16 characters from some reason. – Stuart Sloan Feb 21 '19 at 18:00
  • Im on mojave also. – Stuart Sloan Feb 21 '19 at 18:18
  • Will ps -ewwo comm work for you? – fd0 Feb 22 '19 at 7:29
  • That's it! Thank you!. I can't believe it was that easy. If you want to put it in the answer I'll accept it. – Stuart Sloan Feb 22 '19 at 16:32

So on MacOS X this command works great. This was provided by @fd0

ps -ewwo comm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.