Using Screen

GNU Screen is a terminal multiplexer. You can use it to run multiple instances of a interactive shell in the same "window". It is the same concept as running multiple tabs on a web browser. Instead of clicking on a "+" symbol to create another tab, you use keyboard shortcuts. You can also detach and reattach screens as you like. Another feature of screen is that it will keep programs running if you accidentally close the terminal. CBI has screen function installed on the bishop server so if you would like to use this feature please ssh into bishop to use it. Using Screen: First you start screen simply by typing "screen" into the command. Then you'll notice that on top of your terminal you'll see [screen 0: shell] username@bishop on the title of the terminal. This means you have successfully started the screen. Now you are able to create new screen windows and use other features of screen. You create new windows by pressing ctrl+a and then type in "c" and hit enter. You'll notice that the terminal flashes and [screen 1:] will now be the title of your terminal. This means you have created a new screen. You can shift through your screens with several different shortcut commands.

  1. ctrl+a n or ctrl+a p, This basically switch to the next or previous screen
  2. ctrl+a 0-9, the numbers are displayed on the title of the screen

Detaching and Reattaching: You can use screen to run programs and close them so it runs in the background. In order to do this you would simply run the program in one of your screen window and then detach the screen. You detach the screen by pressing ctrl+a and then type "d" and press enter. Then you'll notice that you're back into the original terminal where you started screen in. Then in order to bring back the same screen you detached you just type "screen -r" in the terminal. Keyboard Shortcuts: The following are some of the common shortcuts you can use while using screen. All shortcuts in screen is preceded by ctrl+a and they are case-sensitive.

  • c - Creates new window.
  • 0 thru 9 - Switches between windows
  • n - Switch to next window
  • p - Switch to previous window
  • A - Change the name of the window
  • d - Detach the current screen
  • K - Kills the current window
  • list - Lists all the screen

For more and detailed information about shortcuts run the command "man screen" in your terminal. Closing Screen: In order to fully close screen you would have to close every screen that has been opened. Otherwise it will keep running in the background. You can check to see all the screens open by entering command "screen -list".