Generating a process list without ps (BASH)

On occasion you may need to generate a process list without using "ps" (because you believe it's been compromised in some way)

This snippet will generate basic output giving PID and process details

Similar To

  • ps

Details

  • Language: BASH

Snippet

for i in `ls -1 /proc/ | egrep "([0-9]+)"`
do
    echo "$i:[`cat /proc/$i/comm`] `cat /proc/$i/cmdline`"
done