Hello everyone,
Following command sends word 'test' followed by an enter into a screen session (in our case screen_1). How do I print the result, if that would result ? How do I print the result, even if the program running in the session is locked ?
Thank you
screen -S screen_1 -X stuff "test"`echo -ne '\015'`
Been a while since I ran screen!
man page screen section 1
C-a h (hardcopy) Write a hardcopy of the current window to the
file "hardcopy.n".
1 Like
I've tried to use the command but , it didn't work , can you give me an example ?
Thank you !
C-a means cntrl-a, I hope you know.
Maybe you do not have the latest screens. Compare revisions with the man page.
I moved on to xterms with the 56k modem about a decade ago. I'd have to install it.
Maybe there is logging you can enable before, so everything is in a file before it locks up, at which point it takes major magic to change things.
1 Like
Thank you for the quick answers DGPickett , and thank you for info. Like you said , in a screen session ctrl+a and then h + enter , generates a hardcopy of that screen . The information is useful but i couldn't use ctrl+a in a bash script. So a started to search on google more info abaout hardcopy and i finally find what a needed :
screen -S screen_1 -X hardcopy hardcopy_name;
sleep 3
cat hardcopy_name
Remeber : The hardcopy is created in the directory from where screen is started !
I use ksh, HISTSIZE=32767, .sh_history not in volatile /tmp, and periodically I make a gzipped backup that my command search scripts can look in to expand my ksh typein history. Then I use command-line stuff where I can, since I will have history, rather than long sessions. For instance, in place of hangin around as root where I might accidentally do something destructive, and having my session uistory be up there on root, I call it on this shell history like this:
su - root -c 'little command sequence'