In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "the use of the screen command of the terminal multiplexer under Linux". In the daily operation, I believe that many people have doubts about the use of the screen command of the terminal multiplexer under Linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about the use of the screen command of the terminal multiplexer under Linux. Next, please follow the editor to study!
Introduction
Screen or GNU screen is a terminal multiplexer. In other words, this means that you can start a screen session and then open any number of windows (virtual terminals) in that session. Even if disconnected, processes running on the screen will continue to run when its window is not visible.
Install Linux screen
Screen packages are now pre-installed on most Linux distributions. You can check to see if it is installed on the system by typing:
Linuxmi@linuxmi:~/www.linuxmi.com$ screen-version Screen version 4.08.00 (GNU) 05-Feb-20
If you do not have screen installed on your system, you can easily install it using the package manager of the distribution.
Install screen on Ubuntu and Debian
Linuxmi@linuxmi:~/www.linuxmi.com$ sudo apt install screen
Install screen on CentOS and Fedora
Linuxmi@linuxmi:~/www.linuxmi.com$ sudo yum install screen
Start Linux screen
To start a screen session, simply type screen on the console:
Screen
This opens a screen session, creates a new window, and starts a shell in that window.
Now that you have opened a screen session, you can get a list of commands by entering the following command:
Ctrl+a?
Named session
Naming sessions is useful when running multiple screen sessions. To create a naming session, run the screen command with the following parameters:
Screen-S session_name
It's always a good idea to choose a descriptive and meaningful session name.
Use the Linux Screen window
By default, when you start a new screen session, it creates a single window that contains shell.
You can have multiple windows in a screen session.
To create a new window with shell, type Ctrl+a c, which will be assigned the first available number in the range 0.9.
Here are some of the most common commands for managing Linux Screen windows:
Ctrl+a c create a new window (with shell)
"Ctrl+a" lists all windows
Ctrl+a 0 switch to window 0 (by number)
Ctrl+an A renames the current window
Ctrl+a S divides the current area horizontally into two regions
Ctrl+a | divides the current area into two regions vertically
Ctrl+a tab switches the input focus to the next area
Ctrl+a Ctrl+a switches between current and previous areas
Ctrl+a Q closes all areas except the current area
Ctrl+a X closes the current area
The following is a list of important keyboard shortcuts for managing nested sessions.
Ctrl + a "- lists all sessions
Ctrl + a 0-switch to session number 0
Ctrl + a n-switch to the next session
Ctrl + a p-switch to previous session
Ctrl + a S-split the current region horizontally into two regions
Ctrl + a l-divides the current region vertically into two regions
Ctrl + a Q-close all sessions except the current session
Ctrl + a X-close the current session
Ctrl + a\-terminates all sessions and terminates Screen
Ctrl + a?-displays key bindings. To exit, press enter # to lock the session
Screen has an option to lock the session. To do this, press Ctrl + an and x. Enter your Linux password to lock.
Separate from the Linux screen session
You can detach from the screen session at any time by typing:
Ctrl+a d
After detaching from the session, programs running in the screen session will continue to run.
Reconnect to Linux screen
To resume a screen session, use the following command:
Screen-r
If you have more than one screen session running on your computer, you need to append the screen session ID after r.
To find the screen session ID, you can list the currently running ones using the following command:
Linuxmi@linuxmi:~/www.linuxmi.com$ screen-ls There is a screen on: 15105.pts-2.linuxmi (10:11:02, November 18, 2020) (Attached) 1 Socket in / run/screen/S-linuxmi.
If you want to restore 15105.pts-2, type the following command:
Linuxmi@linuxmi:~/www.linuxmi.com$ screen-r 15105
Custom Linux screen
If the / etc/screenrc and ~ / .screenrc files exist, read its configuration parameters from the screen when it starts. We can modify the default screen settings according to our own preferences through the .screenrc file.
The following is an example ~ / .screenrc configuration with custom status lines and several additional options:
~ / .screenrc # turn off welcome information startup_message off # disable visual ringtone vbell off # set the rollback buffer to 10000 defscrollback 10000 # Custom status Line hardstatus alwayslastline hardstatus string'% {= kG} [% {G}% H% {g}] [% {= kw}%?%-Lw%?% {r} (% {W}% n% f% t%?% u)%?% {r })% {w}%?% + Lw%?%?%=% {g}] [% {B}% mmuri% d% {W}% c% {g}]'
Basic Linux screen usage
Here are the most basic steps to get started with screen:
At the command prompt, type screen.
Run the required program.
Use the key sequence Ctrl-a + Ctrl-d to detach from the screen session.
Type to reconnect to the screen session screen-r.
At this point, the study of "how to use the screen command of the terminal multiplexer under Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.