Is it possible to name the 'screen' logfil

2019-03-18 05:25发布

Upon running screen with the -L flag, a file called 'screenlog.0' is created and all output written to it (which is great), but I will be running several screen sessions and I need to identify the logs with a unique number. Is it possible to change the log name?

4条回答
爷、活的狠高调
2楼-- · 2019-03-18 05:50

Probably the easiest way is to use the following:

screen -L -Logfile log_filename your_command
查看更多
我只想做你的唯一
3楼-- · 2019-03-18 05:55

Alternatively, there's a way to do it online.

Enter command mode in screen via Ctrl+a, : and use the logfile command with the name of the file you want as argument, eg: logfile whatevernameyoulike.log

Source: screen man page

查看更多
乱世女痞
4楼-- · 2019-03-18 05:57

You can edit your .screenrc file and add something like this

logfile /tmp/myownlog

Edit: already answered: https://serverfault.com/questions/248193/specifying-a-log-name-for-screen-output-without-relying-on-screenrc

查看更多
贪生不怕死
5楼-- · 2019-03-18 06:04

Use script command inside your screen session.

查看更多
登录 后发表回答