Well this is probably something which should be advertised with flash lights during every start of remote terminal. This is live saving command and also probably something you most probably forget to use in the worst time on the worst place…

Command screen preserves remote terminal up and running in case your remote communication is interruptet. NEVER forget to use this command if you want to run some script or import/ export or query etc. and if there is even the slightest possibility that it will run for longer time. What is longer? It depends… Many servers behave unexpectedly. Something can run very quickly on your slowest local virtual machine but on some remote production server it can take “ages”. Why? Well there is always some reason therefore always “hope for the best but prepare for the worst” and use SCREEN command to preserve connection.

Usage: //TODO

  • to start “preserved connection” just enter screen in terminal
    • even better is to give the session some name: screen -S 1
      • in this case session will have the name “1” – this you will see later in “screen -r”
  • to get help:
    • press Ctrl+A and then ? – you will see help page
  • to see running screens:
    • screen -r  / screen -ls
      • you will see which “screened” connections exist and which are attached/ not attached
  • to reconnect previously “screened” connection:
    • screen -RR
      • this command “forces” to reattaching of existing “screened” session
  • to use more screens in one terminal:
    • type “screen” in terminal
    • start what ever you need
    • press “CTRL+a” followed by “c” – you will get another “screen” prompt
    • to switch between “screens” use “CTRL+a” followed by “n”
  • another “screen” hot keys:
    • CTRL+a k = kill current screen prompt
    • CTRL+a w = list all screen windows
    • CTRL+a CTRL+a = switch between screen windows
    • CTRL+a d = deattach screen prompts but keep them running and terminal also