In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to use the screen command in Linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
The Linux screen command can become a lifeguard when you need to ensure that long-running tasks are not killed when the SSH session is interrupted. Here is how to use it.
If you have to restart a time-consuming process because the SSH session is disconnected, you may be happy to learn about an interesting tool that can be used to avoid this problem: the screen tool.
Screen is a terminal multiplexer that allows you to run multiple terminal sessions in a single SSH session and detach or reconnect from them at any time. The process of doing this is very simple, involving only a few commands.
To start a screen session, simply type screen in the SSH session. You can then start a long-running process and type Ctrl + A Ctrl + D to detach from the session at the appropriate time, and then type screen-r to reconnect.
If you are running multiple screen sessions, a better option is to specify a meaningful name for each session to help you remember the task you are working on. Using this method, you can start each session with the following command:
$screen-S slow-build
Once multiple sessions are running, to reconnect to a session, you need to select it from the list. In the following command, we list the currently running sessions, and then reconnect one of them. Notice that both sessions are marked as detached at the beginning.
$screen-lsThere are screens on: 6617.check-backups (09 Sockets in 26 lsThere are screens on 04:35:30 PM) (Detached) 1946.slow-build (09 Accord 26 Universe 02:51:50 PM) (Detached) 2 Sockets in / run/screen/S-shs
Then, reconnect to the session and ask you to provide the name assigned to the session. For example:
$screen-r slow-build
In a detached session, the process that remains running will continue to process, while you can perform other work. If you use one of these screen sessions to query the screen session, you can see that the current reconnected session appears as Attached again.
$screen-lsThere are screens on: 6617.check-backups (09 Sockets in 26 lsThere are screens on 04:35:30 PM) (Attached) 1946.slow-build (09 Accord 26 Universe 02:51:50 PM) (Detached) 2 Sockets in / run/screen/S-shs.
You can use the-version option to query the running version of screen.
$screen-versionScreen version 4.06.02 (GNU) 23-Oct-17 install screen
If which screen does not provide information on the screen, the tool may not be installed on your system.
$which screen/usr/bin/screen
If you need to install it, one of the following commands may be appropriate for your system:
Sudo apt install screensudo yum install screen
When you need to run a time-consuming process, if your SSH session is disconnected for some reason, it may interrupt the time-consuming process, then the screen tool will come in handy. And, as you can see, it is very easy to use and manage.
The following is a summary of the commands used above:
Screen-S start session Ctrl+A Ctrl+D detach from session screen-ls list session screen-r reconnect session above is all the content of this article "how to use screen commands in Linux", thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.