Go to the previous, next section.

New Window

This section describes the commands for creating a new window for running programs. When a new window is created, the first available number from the range 0...9 is assigned to it. There can be no more than 10 windows active at any one time.


Command: chdir [directory]

Change the current directory of screen to the specified directory or, if called without an argument, to your home directory (the value of the environment variable $HOME). All windows that are created by means of the screen command from within `.screenrc' or by means of C-a : screen ... or C-a c use this as their default directory. Without a chdir command, this would be the directory from which screen was invoked. Hardcopy and log files are always written to the window's default directory, not the current directory of the process running in the window. You can use this command multiple times in your `.screenrc' to start various windows in different default directories, but the last chdir value will affect all the windows you create interactively.

Screen Command

Command: screen [opts] [n] [cmd [args]]

(C-a c, C-a C-c)
Establish a new window. The flow-control options (`-f', `-fn' and `-fa'), title option (`-t'), login options (`-l' and `-ln') , terminal type option (`-T term') and scrollback option (`-h num') may be specified for each command. If an optional number n in the range 0...9 is given, the window number n is assigned to the newly created window (or, if this number is already in-use, the next available number). If a command is specified after screen, this command (with the given arguments) is started in the window; otherwise, a shell is created.

If a tty (character special device) name (e.g. `/dev/ttyS0') is specified as cmd, then the window is directly connected to this device. This is similar to the cmd `kermit -l /dev/ttyS0 -c' but saves resources and is more efficient.

Thus, if your `.screenrc' contains the lines

# example for .screenrc:
screen 1
screen -fn -t foobar 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). If you do not include any screen commands in your `.screenrc' file, then screen defaults to creating a single shell window, number zero. When the initialization is completed, screen switches to the last window specified in your .screenrc file or, if none, it opens default window #0.


Command: setenv var string

Set the environment variable var to value string. If only var is specified, the user will be prompted to enter a value. If no parameters are specified, the user will be prompted for both variable and value. The environment is inherited by all subsequently forked shells.

Command: unsetenv var

Unset an environment variable.


Command: shell command

Set the command to be used to create a new shell. This overrides the value of the environment variable $SHELL. This is useful if you'd like to run a tty-enhancer which is expecting to execute the program specified in $SHELL. If the command begins with a `-' character, the shell will be started as a login-shell.

Command: shelltitle title

Set the title for all shells created during startup or by the C-a C-c command. See section Naming Windows (Titles), for details about what titles are.


Command: term term

In each window screen opens, it sets the $TERM variable to `screen' by default, unless no description for `screen' is installed in the local termcap or terminfo data base. In that case it pretends that the terminal emulator is `vt100'. This won't do much harm, as screen is VT100/ANSI compatible. The use of the term command is discouraged for non-default purpose. That is, one may want to specify special $TERM settings (e.g. vt100) for the next screen rlogin othermachine command. Use the command screen -T vt100 rlogin othermachine rather than setting (term vt100) and resetting (term screen) the default before and after the screen command.

Go to the previous, next section.