-   Linux - Software (
-   -   how to take snapshot in linux from terminal (

tkmsr 11-20-2007 10:54 AM

how to take snapshot in linux from terminal
I want to take a screen shot on a linux terminal by a shell script and also want this script to be run by a php script is there any way to do this

matthewg42 11-20-2007 11:52 AM

When you say screen shot, do you mean text-mode screen dump (i.e. a text file containing what is visible on the tty), or a graphical screenshot?

Is the PHP interpreter running in the terminal, or as a separate process (e.g. run by a web server?)

Assuming the answer to those question are "graphical" and "separate process", here's how to do it:

The traditional X-Windows way to save a screenshot of a window is with the xwd program. Usually this program has the user select the window to dump using the mouse, but you can also specify it using the X window ID.

The overview of the process is therefore like this:
  • Get the window-id of the terminal
  • Call xwd for the window-id
  • Post process dump file (e.g. translate to a format like png)

The trick will be getting the window-id...

All times are GMT -5. The time now is 08:31 PM.