Getting full path of executables in 'ps auxwww' output

Solution 1:

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".

Solution 2:

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, its availability may depend on the user's choice of shell, it's pretty nasty and your mileage may vary.


OS X doesn't have a native procfs. There is a port based upon FUSE. Details can be found here. Again, your mileage may vary.