Justin
Justin

Reputation: 818

Is it possible to name the 'screen' logfile from the -L flag?

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 file name?

Upvotes: 39

Views: 55421

Answers (3)

Nan Wang
Nan Wang

Reputation: 776

Probably the easiest way is to use the following (starting from Screen version 4.06.02 and up):

screen -L -Logfile log_filename your_command

Upvotes: 62

Juan Enciso
Juan Enciso

Reputation: 320

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

Enter command mode in Screen via Ctrl+a, : and use the logfile command with the name of the file you want as argument, for example:

logfile whatevernameyoulike.log

Then enter Ctrl+a, H to start recording to the filename you just entered.

Source: Screen man page

Upvotes: 21

Eun
Eun

Reputation: 4178

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

logfile /tmp/myownlog

It is also answered at Specifying a log name for screen output without relying on .screenrc.

Upvotes: 22

Related Questions