PDA

View Full Version : [SOLVED] need script/program to capture text on tty1 terminal console



@vijay@
April 11th, 2008, 05:29 AM
is it possible to capture the text on the tty1 terminal console (ctrl+alt+F1) as it is (as u see on the monitor) to a text file
and update it every 2 secs ???
can someone please give me script or program

thanx in advance

kerry_s
April 11th, 2008, 06:07 AM
hmm, depends on what you want to capture.

for instance using->
command >> command.txt

appends all out put to that text file, using a single " > " will replace any text in the file with the new.

WW
April 11th, 2008, 06:15 AM
Use the screendump command; see man screendump.

E.g.


while true; do screendump 1 > screenshot1 ; sleep 2 ; done

will copy tty1 to the file screenshot1 every two seconds. You'll need root privileges to run screendump, so use sudo.

nanotube
April 11th, 2008, 06:22 AM
also consider ttysnoop (the linux equivalent of bsd's 'watch'), which will enable you to monitor any tty "live".

@vijay@
April 11th, 2008, 01:31 PM
thanx for the quick replies

@ WW
i want the output to be in text format

@nanotube
how to use ttysnoop ???
i tried "ttysnoop 1"
but it says cannot connect to server :confused:

WW
April 11th, 2008, 02:34 PM
@ WW
i want the output to be in text format

It is. From the beginning of the man page:


DESCRIPTION
The screendump command dumps the contents of virtual console N , (or the current console
if N is omitted) to standard out.

The file that I called screenshot1 is a text file.

nanotube
April 11th, 2008, 03:40 PM
thanx for the quick replies

@ WW
i want the output to be in text format

@nanotube
how to use ttysnoop ???
i tried "ttysnoop 1"
but it says cannot connect to server :confused:

man ttysnoop for details :)

but if all you really want is a text file with the tty content, screendump is probably your best bet, so follow WW's advice.

@vijay@
April 13th, 2008, 06:09 AM
thanx alot guys tht worked like a charm
screendump 1 > screenshot1 didnt work but
screendump /dev/tty1 > file has done the job :popcorn:

u guys just dont know how much u helped me :lolflag:

AND
is there anyway to get the cursor position like which row and column ????