-   Linux - Newbie (
-   -   Creating a screen session in an existing session (

Frits of waterplant 01-13-2007 05:09 AM

Creating a screen session in an existing session

You can create in a existing screen session a second window by pressing CTRL-A C, but how can you do that from command line?

Simon Bridge 01-13-2007 05:25 AM

ctrl-a c uses GNU Screen

"man screen"
screen [ -options ] [ cmd [ args ] ]

Also see article:

Frits of waterplant 01-13-2007 06:06 AM

I think you misunderstood.

I would like to create a new GNU screen window in an existing GNU screen session from the command line, in stead of reattaching the existing screen session and pressing CTRL-A C.

If I start a second application in screen now, it will exist in a second session. So if you would execute


screen -ls
you would get as output:


There are several suitable screens on:
        3460.pts-0.vissekom    (Detached)
        3473.pts-0.vissekom    (Detached)
Type "screen [-d] -r [pid.]" to resume one of them.

I would like to have the two application running in the same session, as two windows. But I start these applications from a script. So I can't use any command keys to do it.

Frits of waterplant 01-18-2007 02:56 AM


bospaadje 01-18-2007 05:53 AM

i found the following section in the man page for screen:

Originally Posted by man screen
if your ".screenrc" contains the lines

# example for .screenrc:
screen 1
screen -fn -t foobar -L 2 telnet foobar

screen creates a shell window (in window #1) and a window with a
TELNET connection to the machine foobar (with no flow-control
using the title "foobar" in window #2) and will write a logfile
("screenlog.2") of the telnet session."

This is documented under the 'screen' option, section 'Customization'. You can create a separate configuration file for your script and specify it with the screen -c file option. Judging from the manpage it's probably not possible to do this directly from the commandline, except by creating the conf file from the script using, for example,

echo "screen 1 some_command" > /folder/screenconf_script
echo "screen 2 some_other_command" >> /folder/screenconf_script

screen -c /folder/screenconf_script

and removing the file again at the end of the script.

I hope this helps you solve your problem.

All times are GMT -5. The time now is 01:31 AM.