Question

I need to get a list of all running PHP scripts but piping my grep through "ls" just gives me a list of all PHP files in my current directory, not the names of the currently running scripts.

How do I accomplish this?

I was able to get the count of currently running PHP scripts

root@myhost:/var/www/cron/jobs# ps -ef | grep *.php | grep -v grep | wc -l

This is kinda what I need:

root@myhost:/var/www/cron/jobs# ps -ef | grep *.php | grep -v grep | ls

THANKS!

Was it helpful?

Solution

If you get the count with this:

root@myhost:/var/www/cron/jobs# ps -ef | grep *.php | grep -v grep | wc -l

then

root@myhost:/var/www/cron/jobs# ps -ef | grep *.php | grep -v grep

should just list the scripts running because all that wc -l does is count the output lines, the lines that contain the scripts you're running.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top