Search code examples
linuxgnu-screenscreenrc

Name screen session log using session name


I'm using this very simple .screenrc:

logtstamp on
logfile /tmp/screenlog-%S.log

I tried launching screens with these two methods:

screen -L -S testing
screen -S tester -L

but the filename used is /tmp/screenlog.0S.log. What am I doing wrong? Using Screen version 4.00.03jw4 (FAU) 2-May-06, and according to the manual I should be able to name the log file using the session name


Solution

  • If you look at the man page (man screen) for your (8-year-old?) version of screen, you'll see it's missing the %S specifier. They must have added it since your version. I'm not sure why Ubuntu 12.04 shipped screen from 2006..

    P.S. I'd advocate looking into tmux. It's a little bit harder to learn, but a lot more flexible: You can move windows between sessions, You can see multiple windows at once, You can nest sessions inside of other sessions, etc.

    Also, if you are just looking to log the output of long-running processes, take a look at nohup.