How to get a process list if you can’t fork any processes?

Recently I got the question what to do if one got a bash session but can’t fork processes on a Linux system.
So here is an attempt to get a processlist just by using bash buildins:

OLDPWD=$PWD
cd /proc
for x in [0-9]*
do
read cmd < /proc/${x}/comm
read cmdl < /proc/${x}/cmdline
printf "%8s - %15s - %s" $x $cmd $cmdl
echo
done
cd $OLDPWD
This entry was posted in Pastes, Technik and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.