October 15, 2010 afternoon | VPS Detective
VPS Detective in the first contact with Linux is the most feared SSH telnet to the Linux VPS when compiling the installation program (such as the installation of LNMP) network suddenly disconnected, or other circumstances that have to be linked to the remote SSH server disconnected, remote execution of the command is forced to stop, can only reconnect, re-run. I believe that some vpser have encountered this problem, today to Vpser to introduce a remote session management tool-screen command.
One, what is the screen command?
Screen is a fullscreen window manager that can multiplex a physical terminal across multiple processes. Screen has the concept of session, users can create multiple screen windows in a screen session, in each of the screens window like the operation of a real telnet/ssh connection window.
Second, how to install the screen command?
In addition to partially streamlined systems or customized systems, most of the screen commands are installed, and if not installed, the CentOS system can be executed:yum install screen;
Debian/ubuntu system execution:apt-get install screen.
Third, screen command use method?
1, the use of common methods
Used to solve the problems we encountered when we started the article, such as when installing LNMP.
1.1 Creating a screen session
You can do this first:screen-s lnmp , screen will create a session named LNMP. VPS Detective http://www.vpser.net/
1.2 Leaving temporarily, preserving tasks or programs in a screen session
When you need to leave temporarily (the program in the session does not close, still running) you can use the shortcut key CTRL + A D (that is, hold down CTRL, then press A,D)
1.3 Resuming a screen session
You can perform the execution again when you return:screen-r lnmp can revert to the working interface of the LNMP session created before leaving. If you forget, or if you do not specify a session name at that time, you can do:screen-lsScreen lists the list of currently existing sessions, such as:
11791.LNMP is the LNMP session created for the screen just now, has temporarily exited the LNMP session, so the status is detached, when the use of Screen-r LNMP state will become attached, 11791 is the process ID of this screen session and can also be used when resuming a session:Screen-r 11791
1.4 Closing a screen session
Execution:exit will prompt: [screen is terminating], indicating that the screen session has been successfully exited. VPS Detective http://www.vpser.net/
2. Remote Demo
First the presenter executes the screen-s test on the server to create a screen session that the viewer can link to on the remote server to perform the screen-x test on which the viewer will appear and synchronize with the presenter.
3. Common shortcut keys
CTRL + A C: Create a window in the current screen session
CTRL + A W: Window list
CTRL + A N: Next window
CTRL + A P: Previous window
CTRL + A 0-9: Switch between No. 0 window and 9th window
If you have any because you can leave a message under this article or to Http://bbs.vpser.net post.
SSH Remote Session management tool-screen use tutorial