screen presentation and use the screen to start a permanent process

Brief introduction

screen is a program developed by the GNU free software for command-line terminal handover. The user can simultaneously connect a plurality of software by the local or remote command-line session, and freely switch between them. GNU Screen can be seen as a command line interface version of the window manager. It provides a unified interface and corresponding functionality to manage multiple sessions.
 
As long as the screen itself is not terminated, the session runs in its interior can be restored. This remote login is particularly useful for users - even if the network connection is interrupted, users will not lose control of the command-line session has opened the. Just log on again to perform screen -r host can resume running session. Similarly, when a temporary leave, can also perform separate command detach, let Screen suspend (switch to the background) in the case to ensure the normal operation inside the program.
 
In screen environment, all sessions are run independently and has its own serial number, input, and output window cache. Shortcut keys can be switched by the user in different windows, and can input and output redirection freedom of each window. screen to achieve the basic text operations, such as copy and paste, etc.; also provides a similar function scroll bar, you can view the status window of history. Partitions and windows can also be named, you can also monitor the activities of the background window. Session Sharing screen allows one or more users to log multiple sessions from a different terminal, and share all the features of the session (for example, you can see exactly the same output). It also provides a mechanism to access the window, the window can be password protected.
 
Common parameters
screen -S yourname -> Create a new call yourname of the session
Screen -ls -> lists all current the session
Screen -r yourname -> return to this yourname the session
Screen -d yourname -> Remote detach one of the session
Screen -d -r yourname -> end the current session and return to the session yourname
 
scenes to be used
Sometimes you need to perform the operation a long time, or perform some hope command window closes after the command to continue, you can create a screen answer
For example: in a start screen monitor redis pace message queue and performs an operation:
1, the new screen session
screen -S  xxname
2, execute the command
while / bin / true; do date && python ./monitor.py; done // real-time monitoring redis queue
3, exit the session
screen -d xxname
 

Guess you like

Origin www.cnblogs.com/pk-tiger/p/11866052.html