1
What I need: A list of all currently running executables with their full path.
Something like this:
1234 /full/path/to/executable 4567 /full/path/to/executable2
Using UNIX95= ps -exo pid,comm
I can get a list with PIDs and the commands like this
11146 /opt/wbem/lbin/cimprovagt 0 4 8 root IOTreeModule 8338 /opt/ssh/libexec/sftp-server 16684 postgres: sfmdb evweb [local] idle 2518 /usr/sbin/stm/uut/bin/tools/monitor/WbemWrapperMonitor 2264 /usr/sbin/psb/bin/diagtxd 8340 -sh 7772 sshd: root@pts/0 8333 sshd: root@pts/1 7777 /opt/ssh/libexec/sftp-server
This is as close I've managed to get using ps
, but it is not good enough:
- Some lines do not include the full path (apparently because they are not started using the full path).
- Extra data after the executable name (I need to support executables with spaces in their name so I can't just split the string)
As such, I've concluded that ps
won't get me all the way.
Is there an equivalent to Linux's /proc where /proc/{pid}/exe points to the executable? If not, is there another way to accomplish this?
Thanks in advance,