Differences between revisions 19 and 20
Revision 19 as of 2021-10-05 16:57:43
Size: 2838
Editor: fioddor
Comment: Category
Revision 20 as of 2021-10-06 03:37:50
Size: 2894
Editor: PaulWise
Comment: cleanups
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:
Line 9: Line 10:
Line 12: Line 14:
With it you can easily run several programs in a logical terminal, regardless whether you are logged or not. In addition, you can remotely use ''screen'' from many computers attaching/detaching at will.` With it you can easily run several programs in a logical terminal, regardless whether you are logged or not. In addition, you can remotely use `screen` from many computers attaching/detaching at will.
Line 15: Line 17:
Line 16: Line 19:
Line 21: Line 25:
Line 25: Line 30:
View availabile windows/terminals: View available windows/terminals:
Line 31: Line 37:
Line 35: Line 42:
Detaching ''screen'' (''screen'' keeps running in the background) Detaching ''screen'' (''screen'' keeps running in the background):
Line 40: Line 48:
Re-attaching ''screen'': (reattach the screen you just detached) Re-attaching ''screen'': (reattach the screen you just detached):
Line 46: Line 55:
Line 63: Line 73:
Line 78: Line 89:
== More Info == == Other documentation ==
Line 80: Line 91:
See [[https://manpages.debian.org/bullseye/screen/screen.1.en.html|man page]] for more info.  * [[DebianMan:screen|Debian screen manual page]]
 * [[https://www.gnu.org/software/screen/manual/|GNU screen manual]]
Line 83: Line 95:
CategorySoftware  CategorySoftware

Screen

Intro

screen has 2 jobs:

  • running processes, even when you're logged out
  • TTY Multiplexer, also spawn several virtual terminals at a logic terminal.

With it you can easily run several programs in a logical terminal, regardless whether you are logged or not. In addition, you can remotely use screen from many computers attaching/detaching at will.

Basic Usage

Calling screen:

user@host:~ $ screen

Creating new virtual terminals:

^a^c (ctrl-a ctrl-c)

View available windows/terminals:

^a^w (ctrl-a ctrl-w)

Switch among virtual terminals:

^a^n, ^a^p, ^a^<number>

Detaching screen (screen keeps running in the background):

^a^d

Re-attaching screen: (reattach the screen you just detached):

user@host:~ $ screen -r

Detach an elsewhere running screen session and reattach to it in the current terminal:

user@host:~ $ screen -rd

screen end whenever all processes running in screen end and you eventually log out the shell. It'll display: screen is terminating

If a process hangs within screen or screen itself hags you should try ctrl-q and ctrl-a ctrl-q. If it doen't help, processes in screen can be killed with ak.

Screen can also distinguish visual bell vs audio bell. Whenever a process sends G (BEL) ''Screen'' either forwards it (audio bell) or signals the BEL with a short screen invertion. With a^g you can switch both methods.

Shell Titles, Margins, and Prompts

When using GNU Screen, the characters sent using the "Escape-k" shell-name-change sequence are included in the line count, which affects the "margin" count and "wrap" functionality of the current shell-input line.

To dynamically change the "shell title" of a GNU Screen shell while also dynamically changing the shell prompt, without affecting the "wrap" count, a "newline" must be sent between sending the shell title and the shell prompt; doing so resets the "wrap" count. Then, to minimize wasted vertical space on the console, one "cursor up" command is sent after the title-change command.

For example, in "bash":

if [[ "$TERM" =~ "screen" ]]; then
   # "GNU Screen" title-change command.
   echo -en "\ek$shellTitle\e\\"
else
   # Generic terminal title-change command,
   echo -en "\e]2;$shellTitle\a"
fi

# Send one "cursor-up" command after the title-change command.
echo -e "\e[1A"

The above may seem like a "hack" solution, but, for now, it works. Please amend this Wiki page if/when a better solution is/becomes available.

Other documentation


CategorySoftware