Screen: Difference between revisions

From Grid5000
Jump to navigation Jump to search
No edit summary
No edit summary
Line 10: Line 10:
* Start a screen session (creates a single window with a  shell  in  it):
* Start a screen session (creates a single window with a  shell  in  it):
  <code class="command">screen</code>
  <code class="command">screen</code>
* Invoke a screen command (consists of a "Ctrl + a" followed by one other character):
* OR start a command in a screen session:
<code class="command">screen command</code>
* Invoke a screen control command (it consists of a "Ctrl + a" followed by one other character):
  C-a <code class="replace"><command_char></code>
  C-a <code class="replace"><command_char></code>
Basics screen manipulation commands are :  
Basics screen commands are :  
  C-a C-c : Create a new window with a shell and switch to that window.
  C-a C-c : Create a new window with a shell and switch to that window.
  C-a "  : Present a list of all windows for selection.
  C-a "  : Present a list of all windows for selection.
  C-a A  : Allow  the  user to enter a name for the current window.
  C-a A  : Allow  the  user to enter a name for the current window.
  C-a C-k : Kill current window
  C-a C-k : Kill current window
Line 26: Line 28:
* Invoke a screen customization command (used to set options):
* Invoke a screen customization command (used to set options):
  C-a : <code class="replace"><customization_command></code>
  C-a : <code class="replace"><customization_command></code>
== Multiuser mode ==
With multiuser mode, <code class="command">screen</code> reveal itself as a powerfull colaborative administration tool.
=== Requirements ===
* <code class="command">screen</code> binary file must be setuid-root:
<code class="command">chmod</code> u+s /usr/bin/screen
{{Note|text=The setuid setting is not mandatory if once the screen session is created by the first user, the second user can become <code>root</code> to attach the session at his turn (say, the second user is a admin).}}
* <code class="command">screen</code> socket directory must not be NFS mounted (your default must be changed if it is <code class="dir">$HOME/.screen</code>):
<code class="env">SCREENDIR</code>=/tmp/screen-<code class="replace">username1</code>
{{Note|text=There is nothing to configure on Debian systems, as the <code class="env">SCREENDIR</code> is correctly set on this distro by default.}}
=== Howto ===
* User, named <code>username1</code>, initiates a basic screen session name ''test'':
<code class="command">screen</code> -S test
* Then, he enables multiuser mode for this session:
C-a : multiuser on
* After that, he allows the others, like <code>username2</code>, to connect to his session:
C-a : acladd <code class="replace">username2</code>
* At last, allowed users, like <code>username2</code>, can attach to the multiuser session initiated by <code>username1</code>:
<code class="command">screen</code> -r <code class="replace">username1</code>/test
* To lists screen from others:
<code class="command">screen</code> -ls <code class="replace">username1</code>/


{{Note|text=A <code class="file">$HOME/.screenrc</code> file can be use to systematically setup the multiuser mode variables <code>multiuser</code> and <code>acladd</code>. One is provided in the svn repository: [https://gforge.inria.fr/plugins/scmsvn/viewcvs.php/*checkout*/admin/trunk/misc/screenrc?root=grid5000 screenrc], save is in your home directory as <code class="file">~/.screenrc</code>}}
{{Note|text=A <code class="file">$HOME/.screenrc</code> file can be use to systematically setup the multiuser mode variables <code>multiuser</code> and <code>acladd</code>. One is provided in the svn repository: [https://gforge.inria.fr/plugins/scmsvn/viewcvs.php/*checkout*/admin/trunk/misc/screenrc?root=grid5000 screenrc], save is in your home directory as <code class="file">~/.screenrc</code>}}

Revision as of 16:39, 3 July 2019

screen is a screen manager with VT100/ANSI terminal emulation.

Basics

  • Start a screen session (creates a single window with a shell in it):
screen
  • OR start a command in a screen session:
screen command
  • Invoke a screen control command (it consists of a "Ctrl + a" followed by one other character):
C-a <command_char>

Basics screen commands are :

C-a C-c : Create a new window with a shell and switch to that window.
C-a "   : Present a list of all windows for selection.
C-a A   : Allow  the  user to enter a name for the current window.
C-a C-k : Kill current window

Further options are available in the man pages.

  • Detach from this screen terminal (program continues to run when its associated screen session is detached):
C-a d : Detach screen from this terminal.
  • Reattach a session (brings foreground a previously detached session):
screen -r
  • Invoke a screen customization command (used to set options):
C-a : <customization_command>
Note.png Note

A $HOME/.screenrc file can be use to systematically setup the multiuser mode variables multiuser and acladd. One is provided in the svn repository: screenrc, save is in your home directory as ~/.screenrc