Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I view a log file generated by screen (screenlog.0)

So I just found out I can create log files of everything I do in screen (C-a H). Sounds like a nice way to keep track of potential goofs in a particular screen session. However, when I went to try it out the logfile is reported as being a binary file (and can't be viewed like a regular text as such). So am I missing something? A quick man page looksee and searching Google (and SO) turns up nothing about this.

So my question is: How do I generate plain text log files in screen?

Assuming the answer is "What a noob... how about you try making them? RTFM." my question becomes: How do I use less to view screen logfiles I've created (since less screenlog.0 does not work on a binary file)?


EDIT: So cat works fine but less complains that the file is binary... why?


SOLUTION: as jcomeau_ictx helpfully pointed out, you can view these logfiles fine with cat or more but with less you must add the -r flag less -r screenlog.0

like image 532
rg88 Avatar asked Dec 12 '10 04:12

rg88


People also ask

How do I view the monitor log?

You can find the screenlog. 0 file in screen 's current working directory (cwd). This is either the directory that was the cwd when you started screen , or it's a directory you subsequently changed to using the :chdir screen command.

How do I view screen logs in Linux?

Enable Screen Logging in Linux To activate the screen logging function, just press “Ctrl-A” and “H“.

How do I scroll in screen session?

Screen Tricks To scroll up within a screen window, use this command: CTRL+a then ESC, #Press CTRL KEY and 'A' KEY together and then hit the ESC KEY #to scroll using the arrow keys hit ESC again to exit.


1 Answers

I just found a screenlog.0 on the net; it is plain text, with some escape sequences. Just 'cat' the file, you should be able to view it just fine.

[after more checking] Control-A H is what generates the screenlog on my system. And though 'cat' works, you'll miss a lot of data. Use 'more' instead of 'less' to interpolate the escape codes.

like image 58
jcomeau_ictx Avatar answered Sep 24 '22 19:09

jcomeau_ictx