Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Consider the following lines from a "ps auxwww" output:

root      4262   0.0  0,1    76592   1104 s005  Ss   10:02am   0:00.03 login -pf yo
yo        4263   0.0  0,0    75964    956 s005  S    10:02am   0:00.03 -bash

Question 1: How do I force ps to expand all commands in the COMMAND column to their fully qualified path names? I want login to be resolved to /usr/bin/login and bash to /bin/bash.

Question 2: Is there an equivalent to procfs in MacOS X? That is - is there a file based mechanism to easily obtain process information?

share|improve this question
up vote 3 down vote accepted

Try this instead:

ps ax -o pid,cmd

You can reformat it as you wish (read the man page for details).

Finally, I think that ps (and even cat /proc/*/cmdline) will report the command the way it was launched. So if no full path was given, it will appear as just "command" instead of "/path/to/command".

share|improve this answer
Close! On OS X and FreeBSD (and probably other BSD-based systems) it's "ps axwww -o pid,command". – Gerald Combs Sep 4 '09 at 17:07

Firstly processes can change the title reported by ps so it's not very reliable in itself. You could try the environment variables using the 'e' flag.

ps auxwwwe

Within these should be a builtin '_' variable as described here.

For every command that is run as a child of the shell, sh sets this variable to the full path name of the executable file and passes this value through the environment to that child process.

This holds true for sh on BSD as it does Linux. I believe that this can't overwritten by the user. However it's availability may depend on the user's choice of shell, it's pretty nasty and YMMV.

OSX doesn't have a native procfs. There is a port based upon FUSE. Details can be found here. Again YMMV.

share|improve this answer
Ewwww ! – Dennis Williamson Sep 4 '09 at 12:41

Stop messing around with ps and use cat /proc/pid/cmdline .

You can use wildcards such as /proc/*/cmdline .

share|improve this answer
Check question #2 about procfs. – Dan Carley Sep 4 '09 at 12:39

extract all process ids and full path from /proc:

ls -l /proc/*/exe 2>/dev/null | awk '{print $8 " " $10}'
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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