Linux screen tricks: recording the day

Source: Internet
Author: User

Here's how to record screen logs.

The first method:

Add option-L at startup (Turn on output logging.), screenlog.0 files are generated in the current directory.

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/9A/57/wKioL1lUkYHyvGn1AAAsfLIR_Y8131.png-wh_500x0-wm_ 3-wmp_4-s_1932525752.png "title=" Jc83ow]t{n ' ~ $BT [) 7@$) $B. png "alt=" wkiol1lukyhyvgn1aaasflir_y8131.png-wh_50 "/ >

Screen-l-DMS test means to start a session that is in disconnected mode at the beginning, and the name of the session is test.

Screen-r Test connects the session, and all screen output in the session is logged to the screenlog.0 file.

The second method:

No option-l, after starting, press CTRL + A under Screen session H, also generate screenlog.0 files in the current directory.

The first time you press CTRL + A, the lower left corner of the screen prompts creating logfile "screenlog.0"., Start logging.

Press CTRL + A again, the lower left corner of the screen will prompt logfile "screenlog.0" closed., stop logging.

There is a drawback to the above two methods: When creating multiple screen sessions, each session logs the log to the screenlog.0 file. The content in the screenlog.0 is a bit confusing.

As a workaround, let each screen session window have a separate log file.

Add the following line at the end of the screen configuration file/ETC/SCREENRC:

Logfile/tmp/screenlog_%t.log

%t refers to the name of the Windows window, corresponding to the-t parameter of screen. So when we start screen, we want to specify the name of the window, for example:

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/9A/57/wKioL1lUksHxOzoPAAAeg2xZT9g882.png-wh_500x0-wm_ 3-wmp_4-s_1901446490.png "title=" 3}cg5fv@k@vz3dg9d8te (de.png "alt=" wkiol1lukshxozopaaaeg2xzt9g882.png-wh_50 "/ >

Screen-l-T WINDOW1-DMS test means the test session is started and the window name of the test session is Window1. The screen log is recorded in/tmp/screenlog_window1.log. If you start without the-l parameter, press CTRL + A under Screen session H, the log will also be recorded in/tmp/screenlog_window1.log.




[Email protected] ~]# Screen-ls

There is screens on:

67495.test (Detached)

67752.test (Detached)

2 Sockets in/var/run/screen/s-root.


[Email protected] ~]# screen-r 67495


After entering the 67495 window, execute exit to exit the current window. When all the windows in a session are ended, the session is automatically terminated, and the command line prompts [screen is terminating]. At this point, only one session is viewed:

[Email protected] ~]# Screen-ls

There is a screens on:

67752.test (Detached)

1 Socket in/var/run/screen/s-root.


This article is from the "10732668" blog, please be sure to keep this source http://10742668.blog.51cto.com/10732668/1943057

Linux screen tricks: recording the day

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.