User Tools

Site Tools


screen

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
screen [2021/03/16 21:39] – [Multiple sessions] hc9screen [2024/09/16 07:51] (current) – er” hc9
Line 3: Line 3:
 ===== Introduction ===== ===== Introduction =====
  
-[[http://savannah.gnu.org/projects/screen/|Screen]] is a "terminal multiplexer", i.e., it will let you have multiple virtual terminals in a single window. You will also be able to 1) "detacha screen session, and then detach it in a later moment; 2) share screen sessions.+[[http://savannah.gnu.org/projects/screen/|Screen]] is a terminal multiplexer, i.e., it will let you have multiple virtual terminals in a single window. You will also be able to 1) detach” a screen session, and then detach it in a later moment; 2) share screen sessions.
  
 In this tutorial ''$'' indicates a terminal prompt (just for visual convenience). In this tutorial ''$'' indicates a terminal prompt (just for visual convenience).
  
-A Screen command is usually of the form **CTRL-a KEY**, i.e., you'll have to press the **CTRL** key along with "a", followed by a generic KEY. (Screen's default escape key is **CTRL-a**.)+A Screen command is usually of the form **CTRL-a KEY**, i.e., you'll have to press the **CTRL** key along with a, followed by a generic KEY. (Screen's default escape key is **CTRL-a**.)
  
 You'll need to be a [[http://sdf.org/?join#meta|MetaARPA]] member in order to use Screen on SDF You'll need to be a [[http://sdf.org/?join#meta|MetaARPA]] member in order to use Screen on SDF
  
-If you want a "screencasttutorial, type:+If you want a screencast” tutorial, type:
  
 ''$ ttyplay /ftp/pub/users/jecxjo/howto/screen'' ''$ ttyplay /ftp/pub/users/jecxjo/howto/screen''
Line 25: Line 25:
 ''$ screen'' ''$ screen''
  
-When you run it, a window with some copyright and some other info will show up, with "[Press Space or Return to end.]at the bottom. OK, as it says, you can now press "Spaceor "Enter". You will then see your shell prompt and nothing else. That's fine: you can now run your programs as usual, the difference is that they will run under a Screen session. You can detach it by typing **CTRL-a d**. Screen will keep your session running. Now if you logout, then log back in, and type:+When you run it, a window with some copyright and some other info will show up, with [Press Space or Return to end.]” at the bottom. OK, as it says, you can now press Space” or Enter. You will then see your shell prompt and nothing else. That's fine: you can now run your programs as usual, the difference is that they will run under a Screen session. You can detach it by typing **CTRL-a d**. Screen will keep your session running. Now if you logout, then log back in, and type:
  
 ''$ screen -r'' ''$ screen -r''
Line 35: Line 35:
 ''$ screen -d -r'' ''$ screen -d -r''
  
-The "-dflag will detach Screen, while "-rwill reattach. There are various types of "detachand  flags. For instance, if you type the previous command and there was no screen session to be resumed, you'll get a "There is no screen to be detached.message. In this case you'll probably need:+The -d” flag will detach Screen, while -r” will reattach. There are various types of detach” and  flags. For instance, if you type the previous command and there was no screen session to be resumed, you'll get a There is no screen to be detached.” message. In this case you'll probably need:
  
 ''$ screen -d -R'' ''$ screen -d -R''
Line 47: Line 47:
 ''$ screen'' ''$ screen''
  
-will create a new window, leaving the previous window untouched, though not visible. Instead of typing "screen", you can use the shortcut **CTRL-a c**.+will create a new window, leaving the previous window untouched, though not visible. Instead of typing screen, you can use the shortcut **CTRL-a c**.
  
 You can create as many windows as you want. You can swith between windows with **CTRL-a n** (next window) and **CTRL-a p** (previous window). It's also possible to select windows by number. Typing **CTRL-a 1** will open window number 1, **CTRL-a 2**, to window 2, and so on. You can create as many windows as you want. You can swith between windows with **CTRL-a n** (next window) and **CTRL-a p** (previous window). It's also possible to select windows by number. Typing **CTRL-a 1** will open window number 1, **CTRL-a 2**, to window 2, and so on.
  
-How do you know what's a window number? Well, you can type **CTRL-a "** (yeah, that's a double quote). In that case a menu with a windows list will open. You can select a number and press enter to go to that screen. An easier way is to have a "hard status linethat shows you each window number. For doing this in a permanent manner, you'll have to create a ".screenrc(Screen's customization file) in your $HOME directory and write in it the following lines:+How do you know what's a window number? Well, you can type **CTRL-a ** (yeah, that's a double quote). In that case a menu with a windows list will open. You can select a number and press enter to go to that screen. An easier way is to have a hard status line” that shows you each window number. For doing this in a permanent manner, you'll have to create a .screenrc” (Screen's customization file) in your $HOME directory and write in it the following lines:
  
 <file config .screenrc> <file config .screenrc>
Line 66: Line 66:
 ===== Multiple sessions ===== ===== Multiple sessions =====
  
-It's possible to have various Screen sessions running, each one with their own set of windows open. If you started Screen by just typing "screen", a new session is created. If you detach and type "screenagain, a new session will start. If you now type:+It's possible to have various Screen sessions running, each one with their own set of windows open. If you started Screen by just typing screen, a new session is created. If you detach and type screen” again, a new session will start. If you now type:
  
 ''$ screen -ls'' ''$ screen -ls''
Line 80: Line 80:
 where HOST is the hostname and YOU is your username. where HOST is the hostname and YOU is your username.
  
-You can reattach a screen session by name. Say for instance that you want to resume the "4522.pts-8.HOSTsession. In this case you'll have to type:+You can reattach a screen session by name. Say for instance that you want to resume the 4522.pts-8.HOST” session. In this case you'll have to type:
  
 ''$ screen -r 4522.pts-8.HOST'' ''$ screen -r 4522.pts-8.HOST''
  
-Obviously "4522.pts-8.HOSTis not a very userfriendly session name. You can give a meaningful name by starting screen as:+Obviously 4522.pts-8.HOST” is not a very userfriendly session name. You can give a meaningful name by starting screen as:
  
 ''$ screen -S mysession'' ''$ screen -S mysession''
  
-where "mysessionis the name you want to give to your session (e.g., "work").+where mysession” is the name you want to give to your session (e.g., work).
  
 ===== Splitting windows ===== ===== Splitting windows =====
  
-It could be useful to split a window so that you can have two programs running on the viewport. In this case, type **CTRL-a S** and you'll see that the window will be split in two regions, with the one at the bottom blank. You can swith to it with **CTRL-a TAB** (TAB is the tab key) and then select a window by typing its number, or "p(previous) or "n(next), e.g., **CTRL-a 2**. You can always swith through regions with **CTRL-a TAB**.+It could be useful to split a window so that you can have two programs running on the viewport. In this case, type **CTRL-a S** and you'll see that the window will be split in two regions, with the one at the bottom blank. You can swith to it with **CTRL-a TAB** (TAB is the tab key) and then select a window by typing its number, or p” (previous) or n” (next), e.g., **CTRL-a 2**. You can always swith through regions with **CTRL-a TAB**.
  
 It's possible to split the window in more then two regions, each time by typing **CTRL-a S** It's possible to split the window in more then two regions, each time by typing **CTRL-a S**
  
-If you want to split a window vertically, you'll have to either use a //patch(([[http://fungi.yuggoth.org/vsp4s/|Vertical Split for GNU Screen]] provides a vertical split feature for current releases of GNU Screen))// or use a recent version of Screen.+If you want to split a window vertically, you'll have to either use a //patch(([[http://fungi.yuggoth.org/vsp4s/|Vertical Split for GNU Screen]] – provides a vertical split feature for current releases of GNU Screen))// or use a recent version of Screen.
  
 ===== Sharing screen sessions ===== ===== Sharing screen sessions =====
Line 116: Line 116:
 **CTRL-a:password none** **CTRL-a:password none**
  
-**CTRL-a:aclchg SOMEUSER -w "#"**+**CTRL-a:aclchg SOMEUSER -w #**
  
 SOMEUSER should exit screen first, then in the shell, type: SOMEUSER should exit screen first, then in the shell, type:
Line 150: Line 150:
 //**Some notes:**// //**Some notes:**//
  
-  * Screen version that was used "Screen version 4.00.03 (FAU) 23-Oct-06"+  * Screen version that was used Screen version 4.00.03 (FAU) 23-Oct-06
  
   * At the time of writing ( Tue Apr 17 23:01:50 IST 2012 ) all attempts at achieving the above read only functionality by editing .screenrc failed, usually resulting in SOMEUSER having FULL access to HOSTUSER's screen and shell account.   * At the time of writing ( Tue Apr 17 23:01:50 IST 2012 ) all attempts at achieving the above read only functionality by editing .screenrc failed, usually resulting in SOMEUSER having FULL access to HOSTUSER's screen and shell account.
Line 158: Line 158:
   * After SOMEUSER is detachs HOSTUSER might try **CTRL-aF** to resize the screen windows to fit the terminal.   * After SOMEUSER is detachs HOSTUSER might try **CTRL-aF** to resize the screen windows to fit the terminal.
  
-  * For convenience and to reduce typing in screen HOSTUSER might want to have "multiuser onand "password nonein .screenrc. HOSTUSER's screen is still private until a user is permitted to attach with aclchg.+  * For convenience and to reduce typing in screen HOSTUSER might want to have multiuser on” and password none” in .screenrc. HOSTUSER's screen is still private until a user is permitted to attach with aclchg.
  
   * HOSTUSER will hear/see lots of bells if SOMEUSER tries to type into the screen session.   * HOSTUSER will hear/see lots of bells if SOMEUSER tries to type into the screen session.
Line 170: Line 170:
 ===== .screenrc ===== ===== .screenrc =====
  
-As we previously saw, it is possible to customize Screen by writing settings in a file named ".screenrcin your $HOME directory. We will now some useful Screen settings.+As we previously saw, it is possible to customize Screen by writing settings in a file named .screenrc” in your $HOME directory. We will now some useful Screen settings.
  
 === Avoiding the startup message === === Avoiding the startup message ===
Line 192: Line 192:
 </file> </file>
  
-each time you'll type **CTRL-a m** a new window (named "mail")with mutt will be created. Be careful: when you bind a key, you'll overwrite Screen's defaults (e.g., we just lost the "lastmsgkey).+each time you'll type **CTRL-a m** a new window (named mail)with mutt will be created. Be careful: when you bind a key, you'll overwrite Screen's defaults (e.g., we just lost the lastmsg” key).
  
 ===== Cheat sheet ===== ===== Cheat sheet =====
Line 205: Line 205:
  
 **Notes** **Notes**
 +
 ---- ----
 +
 $Id: screen.html,v 1.8 2012/05/08 14:45:50 dickey Exp $ [[http://sdf.org/?tutorials/screen|Screen]] - traditional link (using [[wp>Revision_Control_System|RCS]]) $Id: screen.html,v 1.8 2012/05/08 14:45:50 dickey Exp $ [[http://sdf.org/?tutorials/screen|Screen]] - traditional link (using [[wp>Revision_Control_System|RCS]])
  
screen.txt · Last modified: 2024/09/16 07:51 by hc9