Linux screen tip: Log __linux

Source: Internet
Author: User
Tags sessions

Screen is the Linux window manager, which allows users to create multiple screen sessions, each of which can create multiple window windows, and each window is like an operable real ssh terminal.

Screen Detailed: http://www.linuxidc.com/Linux/2013-10/91612.htm

Linux Screen Super Concise tutorial http://www.linuxidc.com/Linux/2014-04/100040.htm

Linux Common commands for screen http://www.linuxidc.com/Linux/2012-07/65358.htm

Zabbix through the message to send screen graphics report implementation http://www.linuxidc.com/Linux/2013-06/85759.htm

Linux Virtual Terminal Command screen usage detailed http://www.linuxidc.com/Linux/2013-07/87415.htm

Linux tips: Use screen to manage your remote session http://www.linuxidc.com/Linux/2013-10/91612.htm

The following describes how to record the screen log.

The first method:

Add options at startup-L (Turn on output logging.) generates screenlog.0 files in the current directory.

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

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

The second method:

Without option-L, after startup, press CTRL + A in the screen session, the same will generate screenlog.0 files in the current directory.

First press CTRL + A H, the lower left corner of the screen will prompt creating logfile "screenlog.0"., Start logging.

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

The above two methods have a disadvantage : When you create multiple screen sessions, each session logs the log to the screenlog.0 file. The content in the screenlog.0 is rather confusing.

The workaround is as follows, so that each screen session window has a separate log file.

Add the following line to 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:

Screen-l-T WINDOW1-DMS test means that the test session is started, and the window name for 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 in the screen session, the log will also be recorded in/tmp/screenlog_window1.log.

Note that if written as: LogFile./screenlog_%t.log, the log file is logged to the current directory.

Example:

screen-l-T name-s name./name

The first name is the name of the log, the second name is the one that is displayed in the Screen-ls list, and the third name is the program that needs to be run.


Appendix:

source code compilation Installation screen

[Root@web1 soft]# wget ftp://ftp.gnu.org/pub/gnu/screen/screen-4.0.3.tar.gz
[Root@web1 soft]# TAR-XVF screen-4.0.3.tar.gz
[Root@web1 soft]# CD screen-4.0.3
[Root@web1 screen-4.0.3]#./configure
[Root@web1 screen-4.0.3]# make
[Root@web1 screen-4.0.3]# make install
[Root@web1 screen-4.0.3]# install-m 644 ETC/ETCSCREENRC/ETC/SCREENRC
[Root@web1 screen-4.0.3]# CP./screen/bin
Please note that the following two instructions must be executed in a different way from the installation of the general program
Add: Once the new Install screen, follow the steps above, make times wrong:
CONFIGURE:ERROR:!!! No tgetent-no screen
Make: * * * * [Install] Error 1

The workaround is as follows:
Yum-y Install Ncurses-devel


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.