Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells). Screen is usually used when we do work which cannot be terminated. For example when is system patched remotely on unstable network, all work can be destroyed during network failure, in this case, screen is very good solution. Screen session will be running, even my ssh connection will be terminated by network. When screen is called, it creates a single window with a shell in it (or the specified command) and then gets out of your way so that you can use the program as you normally would.
At first I opened screen session and as argument I used YAST. For detach from screen is needed to use control command ctrl-a and then “d” like detach. Together “ctrl-a d”.
# screen yast YaST2 - menu @ system1 âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ â YaST2 Control Center â âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ ââââââââââââââââââââââ ââââââââââââââââââââââââââââââââââââââââââââââââââââ âSoftware â âOnline Update â âHardware â âSoftware Management â âSystem â âAdd-On Products â âNetwork Devices â âInstallation into Directory â âNetwork Services â âMedia Check â âSecurity and Users â âOnline Update Configuration â âVirtualization â âPatch CD Update â âSupport â âSoftware Repositories â âMiscellaneous â â â â â â â â â â â ââââââââââââââââââââââ ââââââââââââââââââââââââââââââââââââââââââââââââââââ [Help] [Quit] F1 Help F9 Quit [detached] #
Now I opened another screen window, but this time without any argument. Detaching is the same as for first session.
# screen Screen version 4.00.02 (FAU) 5-Dec-03 Copyright (c) 1993-2002 Juergen Weigert, Michael Schroeder Copyright (c) 1987 Oliver Laumann This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see the file COPYING); if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Send bugreports, fixes, enhancements, t-shirts, money, beer & pizza to firstname.lastname@example.org [Press Space or Return to end.] # # # uptime 12:26pm up 4:56, 1 user, load average: 0.00, 0.05, 0.05 # # # [detached] #
Now we are running 2 screen session and we will try to find how to connect back. It is simple by using command screen -r. If we have just one screen running we will automatically be connected to this session, in case there is running more session screen will offer us to which tty we want to connect:
# # screen -r There are several suitable screens on: 7401.pts-0.system1 (Detached) 7429.pts-0.system1 (Detached) Type "screen [-d] -r [pid.]tty.host" to resume one of them. # #
We will chose the first option and connect to the screen session with yast. When we want to terminate this session we must close application we used as argument (in this case I closed YAST by f9 key) when we started screen.
# # screen -r 7401.pts-0.system1 YaST2 - menu @ system1 [screen is terminating] #
In next example I had just one screen session opened so no need to enter any argument. For terminating this screen session we have to log out from session by writing exit, or key shortcut ctrl^d.
# # screen -r # # # uptime 12:26pm up 4:56, 1 user, load average: 0.00, 0.05, 0.05 # # # exit exit [screen is terminating] #