PHP Show Linux Processes Primer Tutorial

PHP Show Linux Processes Primer Tutorial

PHP Show Linux Processes Primer Tutorial

The Linux (or unix) command ps shows process information at the command line of a Linux (or unix) operating system. The performance of your Mac laptop or web server can be monitored, albeit in a non-GUI rather crude way using switches with the ps command..

Some good background reading here would be:

  • ps (Linux or unix ps command)
  • exec (as interface to use with PHP on the web)
  • setInterval (Javascript function calls at specified interval)

So … why does the picture for this tutorial not show a Linux command line screen? Well, today we show you the power of the combination of Linux commands and the PHP way to access these commands (in our case processes.php).

Here is a link to downloadable PHP programming source code which you could rename to processes.php as you wish.

Specifically, in processes.php (of the picture) it has lines of code like …

exec(“ps -ef | tail +2 | sed ‘/^[ ]*/s///g’ | sed ‘/ [ ]*/s// /g’ | cut -f2,8,9,10,11,12,13 -d’ ‘ > ” . dirname(__FILE__) . “/ps.ef”);

… to bring (Linux) process information results to the web for display purposes.

If this was interesting you may be interested in this too.

This entry was posted in eLearning, Operating System, Tutorials and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>