cgiexec is a CGI program which allows execution of a server-side Unix command line from the web page. This may be useful for someone who wants to perform some routine Unix admin tasks from the web, like e.g. checking log files, or reading man pages. This is how typically it looks:

may result on my machine in something like

or another example:

may result in something like

cgiexec searches environmental variable QUERY_STRING for "command=xxx" and takes "xxx" as a command-line string to execute. Any leading '/' in command-line are stripped away for security reasons. Only executables from the same directory where cgiexec resides can be executed by cgiexec.

The examples of Unix programs which may be executed by cgiexec are:

  • last
  • who
  • w
  • uptime
  • ps
  • tail
  • netstat
  • man
  • ls
  • ipcs
  • head
  • grep
  • free
  • df
  • cat
  • host
The output from the command line is HTML-formatted and is passed back to the browser as shown above. To download cgiexec go to

Please send your comments to the author at

©1998 PhysTech, Inc. All rights reserved. Last change: July 3, 1999