Unable to specify custom output screenlog.0 file with -L flag

Asked by demon on 2017-08-29

The screen package needs to change the -L switch feature so that a screenlog.0 filename can be given a specific directory/filename output such as doing:

screen -L /tmp/screenlog.1 (2, 3, etc)

Otherwise in order to run multiple screens with -L they each have to be executed from different directories, because they'd all output to the same screenlog.0 file.

The only alternative workaround to this is doing:

screen -dmS workspace | tee screen.log


screen -dmS workspace && screen -S workspace -X stuff $'<command> | tee screen.log\n'

Conclusion, To recode the -L switch to allow to explicitly specify custom filename/directory location for screenlog.0 output ?

Question information

English Edit question
Ubuntu screen Edit question
No assignee Edit question
Last query:
Last reply:

What is the output of:

lsb_release -a; uname -a; apt-cache policy screen


demon (fyredemonyte) said : #2

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
Linux UbuntuHP 4.4.0-93-generic #116-Ubuntu SMP Fri Aug 11 21:17:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  Installed: 4.3.1-2build1
  Candidate: 4.3.1-2build1
  Version table:
 *** 4.3.1-2build1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        100 /var/lib/dpkg/status
     4.2.1-3 500
        500 http://archive.ubuntu.com/ubuntu vivid/main amd64 Packages
I'm also using Screen on a server system:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.10
Release: 16.10
Codename: yakkety
Linux TBclient17 4.8.0-59-generic #64-Ubuntu SMP Thu Jun 29 19:38:34 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  Installed: 4.4.0-4
  Candidate: 4.4.0-4
  Version table:
 *** 4.4.0-4 500
        500 http://nl.archive.ubuntu.com/ubuntu yakkety/main amd64 Packages
        100 /var/lib/dpkg/status

Manfred Hampl (m-hampl) said : #3

Please see https://wiki.ubuntu.com/Releases
Ubuntu 16.10 is not supported any more, and no patches are published any more (not even for fixing critical vulnerabilities). You should upgrade your system from 16.10 to 17.04 in due course.

Manfred Hampl (m-hampl) said : #4

According to the man pages you can use commands like

screen -L 0 command
screen -L 1 other_command

and they will write to screenlog.0 and screenlog.1 respectively. Doesn't this do what you need?

Which system is having the issue?

demon (fyredemonyte) said : #6

Thanks Manfred Hampl, that solved my question.

demon (fyredemonyte) said : #7

@Manfred Hampl,

Actually I just tested your method and it's not working, I get this output:

Cannot exec '1': No such file or directory

In fact, the screen session doesn't even initiate. This is on Ubuntu 16.04

Manfred Hampl (m-hampl) said : #8

What command di you issue to receive this output?

demon (fyredemonyte) said : #9

ader@UbuntuHP:~$ screen -L 1
[screen is terminating]

and I tried

ader@UbuntuHP:~$ screen -dmS test -L 1
ader@UbuntuHP:~$ screen -r
There is no screen to be resumed.


ader@UbuntuHP:~$ screen -S test -L 1
[screen is terminating]


ader@UbuntuHP:~$ screen -dmS test -L 1; screen -S test -X stuff $'free\n'
No screen session found.

All fail to start a screen session

Manfred Hampl (m-hampl) said : #10

Sorry, it seems that i misread the man pages.
The commands that I gave can be put into the ~/.screenrc file.

Maybe you should create a bug report (probably better even in the GNU bug tracker, because that assumedly is not Ubuntu-specific).

demon (fyredemonyte) said : #11

Indeed, however it's technically not a bug, just a lacking feature. But I'll report it.

Can you help with this problem?

Provide an answer of your own, or ask demon for more information if necessary.

To post a message you must log in.