On a linux is running many processes, if one want to list pathes to these processes, one can use the script below:

echo "This script lists all processes paths:"


# get all processes pids
allpids=$(ps aux | awk '{print $2}')


# do an opperation for each pid
for pid in $allpids;do


# read the process symlinks to get paths to the processes
readlink -f /proc/$pid/exe


done
example partial output:

/sbin/init/sbin/udevd
/sbin/iscsiuio
/sbin/iscsid
/sbin/iscsid
/sbin/auditd
/sbin/audispd
/sbin/syslogd
/sbin/klogd
/usr/sbin/irqbalance
/sbin/portmap
/sbin/rpc.statd
/usr/sbin/rpc.idmapd
/bin/dbus-daemon
/usr/sbin/hcid
/usr/sbin/sdpd
/usr/sbin/pcscd
/usr/sbin/acpid
/usr/sbin/hald
/usr/libexec/hald-runner
/usr/libexec/hald-addon-acpi
/usr/libexec/hald-addon-keyboard
/usr/bin/hidd
/usr/sbin/automount
/usr/sbin/sshd
/usr/sbin/xinetd
/usr/sbin/sendmail.sendmail
/usr/sbin/sendmail.sendmail
/usr/sbin/gpm
/usr/sbin/httpd
/bin/bash
/bin/bash
/usr/libexec/mysqld
/usr/sbin/crond
/usr/local/lxlabs/ext/lxlighttpd/sbin/hypervm.httpd
/usr/bin/xfs
/usr/bin/python
/usr/sbin/atd
/usr/sbin/vzeventd
/vz/root/330/usr/local/lxlabs/ext/lxlighttpd/sbin/kloxo.httpd
/vz/root/330/usr/local/lxlabs/ext/php/php
/vz/root/330/sbin/init
/vz/root/330/usr/sbin/named
/vz/root/330/usr/sbin/sshd
/vz/root/330/bin/bash
/vz/root/330/usr/libexec/mysqld
/vz/root/330/bin/bash
/vz/root/330/var/qmail/bin/qmail-send
/vz/root/330/var/qmail/bin/splogger
/vz/root/330/var/qmail/bin/qmail-lspawn
/vz/root/330/var/qmail/bin/qmail-rspawn
/vz/root/330/var/qmail/bin/qmail-clean
/vz/root/330/usr/libexec/courier-authlib/authdaemond
/vz/root/330/usr/bin/tcpserver
/vz/root/330/usr/bin/tcpserver
/vz/root/330/usr/bin/tcpserver
/vz/root/330/usr/bin/tcpserver
/vz/root/330/usr/sbin/crond
/vz/root/330/usr/sbin/saslauthd
/vz/root/330/usr/sbin/saslauthd
/vz/root/330/usr/libexec/courier-authlib/authdaemond
If you know bettter command, script to list all pathes to running processes, please kindly share it