Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed explanation of screen command

2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

I. background

System administrators often need SSH or telent to log in to the Linux server remotely and often run tasks that take a long time to complete, such as system backup, ftp transfer, and so on. Usually we open a remote terminal window for each of these tasks because they take too long to execute. You must wait for them to finish, during which time you can't close the window or disconnect, otherwise the task will be killed and everything will be given up halfway.

II. Brief introduction

GNU Screen is a free software developed by GNU for command line terminal switching. Through the software, users can connect multiple local or remote command line sessions at the same time and switch freely between them.

GNU Screen can be thought of as the command-line interface version of the window manager. It provides a unified interface for managing multiple sessions and corresponding functions.

Session recovery

As long as Screen itself is not terminated, sessions running within it can be resumed. This is particularly useful for remotely logged-in users-even if the network connection is lost, the user does not lose control of the command-line session that is already open. Simply log in to the host again and execute screen-r to resume the session. Similarly, when you are temporarily away, you can also execute the detach command detach to suspend Screen (switch to the background) while ensuring that the programs inside are running properly. This is very similar to VNC in a graphical interface.

Multiple windows

In the Screen environment, all sessions run independently and have their own numbers, inputs, outputs, and window caches. Users can switch between different windows through keyboard shortcuts, and are free to redirect the input and output of each window. Screen implements basic text operations, such as copy and paste, and provides a scrollbar-like function to view the history of window conditions. Windows can also be partitioned and named, and you can monitor the activity of background windows.

Session sharing

Screen allows one or more users to log in to a session multiple times from different terminals and share all the features of the session (such as seeing exactly the same output). It also provides a mechanism for window access, which can protect the window with password.

GNU's Screen official site: http://www.gnu.org/software/screen/

Third, the simple use of the screen command

Open a new screen:

Screen-S [SESSION]

Join a session

Screen-x [SESSION]

Exit and close screen:

Exit

To split the current screen:

Ctrl+a+d

Show all screen that have been opened:

Screen-ls

Restore a screen

Screen-r [SESSION]

Restore after divestiture

Peel off

Restore, or restore the process number

The status displayed after recovery

For long-running programs, it is recommended to open screen to prevent network disconnection so that it can be restored.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report