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

How to use screen in centos

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

System administrators often need to log in to the linux server remotely, sometimes they need to run some tasks that take a long time to complete, and they have to wait until the task is completed before they can be disconnected, but sometimes they are accidentally disconnected and all previous efforts are wasted. So when running some larger tasks, you should use screen in case of accidents.

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. 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

As long as the Screen itself does not terminate, tasks running within it can be restored. This is especially useful for remotely logged-in users, who do not lose control of an open command-line session even if the network connection is lost. 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. Screen also 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, implementing remote assistance, etc.). 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/

Installation steps for screen:

Use the yum command to install screen yum-y install screen

Check whether rpm-qa is successfully installed locally by using the rpm command | grep screen

[root@centos7 ~] # rpm-qa | grep screen

Screen-4.1.0-0.23.20120314git3c2946.el7_2.x86_64

Screen command:

Screen [- AmRvx-ls-wipe] [- d] [- h] [- r] [- s] [- S]

Options:

-An adjusts all windows to the size of the current terminal.

-m forces the creation of a new screen job even if it is already in the job.

-R first attempts to resume offline jobs. If an offline job cannot be found, a new screen job is created.

-v displays version information.

-x resumes previously offline screen jobs.

-ls or-- list displays all current screen jobs.

-wipe checks all current screen jobs and deletes screen jobs that are no longer available.

-d takes the specified screen job offline.

-h specifies the number of buffer rows for the window.

-r resumes offline screen jobs.

-s specifies the shell to be executed when a new window is created.

-S specifies the name of the screen job.

Simple and practical methods:

You can use the screen-ls command to check whether there is a screen before using screen to prevent conflicts.

Create a new window using screen-S name

Use screen-x name to join the existing window.

Exit screen using screen-d name

Use screen-ls to view existing screen

Restore the name name screen using screen-r name

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