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

Simple experiment with liunx screen

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

Share

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

Liunx screen usage

Today, I need to use the screen tool because of my work. I feel very interesting. Record it.

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.

Use experiment

1 installation

Just yum install screen-y is fine.

2 create a new window named ycr

[root@irac01 dev] # screen-S ycr

So it actually opens a screen window.

3 you can view the screen window that has been opened

[root@irac01 dev] # screen-ls

There are screens on:

23653.pts-2.irac01 (Attached)

23617.ycr (Attached)

23181.ycr (Attached)

3 Sockets in / var/run/screen/S-root.

Here, you can see that three windows are open.

4 pause to answer

Then type Ctrl+a d in the screen window

[root@irac01 dev] #

[detached]

View status at this time

[root@irac01 dev] # screen-ls

There is a screen on:

23181.ycr (Detached)

1 Socket in / var/run/screen/S-root.

You can resume this reply in another window at this time.

[root@irac01 ~] # screen-ls

There is a screen on:

23181.ycr (Detached)

1 Socket in / var/run/screen/S-root.

[root@irac01] # screen-r 23181

23181.ycr (Attached)

2 Sockets in / var/run/screen/S-root.

5 session sharing

If you want two replies to share the window

The experiments are as follows

Open a screen in a window

[root@irac01 dev] # screen-ls

There is a screen on:

23181.ycr (Attached)

1 Socket in / var/run/screen/S-root.

In a new window

Screen-x ycr

In this way, the two windows can completely share a screen, and both sides can be operated.

The above is a simple experiment of screen. In addition, screen also has some more advanced applications, such as screen splitting and so on.

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

Servers

Wechat

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

12
Report