Find the answer to your Linux question:
Results 1 to 2 of 2
hello every one!! i want to build a web page which will show the output same (top) command shows in linux... only difference is that i want to show it ...
  1. #1
    Just Joined!
    Join Date
    Jun 2008
    Posts
    2

    Post about linux top command

    hello every one!!

    i want to build a web page which will show the output same (top) command shows in linux... only difference is that i want to show it on browser by using any language.... The main thing that i need is ,, the list of files that top command uses to show output....

    plzzz help me,, waiting for reply........

    thxxxxx in advance

  2. #2
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    You can use 'top' in batch mode or the 'ps' command.

    An easy way to send it to a browser is to use the netcat tool which can listen on a socket and sends the output of any program (here: 'top') to the connecting client. The standard port for http would be 80, but to listen on it we needed to be root, so we take 8000 instead for this example:

    nc -l -p 8000 -c 'top -bn1'
    (listen on TCP port 8000 and send the output I would have gotten when I had typed 'top -bn1' to the first client connecting)


    A more sophisticated way to do this would be setting up a http webserver which either uses CGI to call the top command when it's explicitly requested by the browser (make sure the client can't execute arbitrary commands) or PHP to call this command.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...