Introduction
One of the main requirements for any IT—specialist that have in your backpack of soft skills it's the ability to automatization! But there are utility which help to destroy barrier technical obstacles in Linux. One connect — one session, it's kinda uncomfortable for usage and for this purposes there is screen.
Screen utilizes two main components to facilitate the creation and management of virtual terminals. The first component is the terminal session, which acts as a container for multiple virtual terminals (windows). This terminal session handles the input and output for all the virtual terminals within it.
The second essential component is the terminal multiplexer, which is responsible for managing various aspects of the virtual terminals within the terminal session. It processes commands related to switching between windows and handles the management of virtual terminals.
When a new window is created within screen (by using commands like Ctrl+a, c), the terminal multiplexer generates a new virtual terminal and initiates a shell process (e.g., bash) for that specific window. Each virtual terminal functions as an independent process, managing its input and output, as well as having its own environment and working directory.
When you disconnect from the screen session (Ctrl+a, d), the terminal session remains active on the server, and the virtual terminals continue running in the background. Upon reconnection (e.g., screen -r command), you can regain access to your virtual terminals, and the processes running inside them persist.
In summary, the combination of the terminal session and terminal multiplexer enables screen to provide an efficient way to work with multiple processes within a single terminal window. Moreover, it allows users to disconnect and later resume their work seamlessly, making screen a powerful and versatile tool for efficient command—line operations on Linux.
Requirements
- Root rights;
- Ubuntu 16 or higher version;
- Several knowledge about work OS ;
- Internet connection.
Installation
First of all we need to update and upgrade system packages in our machine for their properly work:
After update and upgrade system we need to install needed package of screen utility, that can help to work with different screens:
Press Y button for start installation process and wait until it will finished.
On almost all distributions we can see that package and installing process won't be complex. That's don't take a long time, be patient. For start utility—type command syntax screen, you will see the hello—message:
Press Space or Return to skip pop—up window then you will see new clear screen, utility created new terminal session which looks like container for save and manage virtual window. Let's create terminal, we have two type of divide screen: horizontal and vertical. Also you can split already divide screen for more complex tasks. All command active through combination Ctrl+a, let's create new window and divide screen, by pressing the button:
Reminder! For this utility, there is a difference when using a large and small register, highlight that moment. We can switch active window by combination:
And switch needed virtual terminal by combination for previous and next terminal accordance:
Also you can displayed on the screen list of th terminal windows:
If you want to see shorter info about it type:
For more clearness usage that windows, you can change label of every window, by pressing:
Switch at the needed window and press bundle of keys:
In our example you can see in the bottom line index and accordance label for that windows. You can see vertical line on the screen, divided it by command:
Also you can divide more complex, let's separate right area by the command below:
At the start you will have no active window slide them as we described before:
For killing one process use combination:
For all bundle of virtual window:
And agree with close statement in the pop—up line. But if you want just minimize window of virtual terminal then you need to type:
That combination minimize all windows exception main of focus, you can also detach from terminal and close connection to the server, but they will still work, by the combination of button:
And attached again by searching needed line:
And type their ID in the command below:
For get more information about combination to use, you can press:
And get help of usage this utility. Let's represent real example of using that utility, obviously we can automize and customize a lot of routine or uncomfortable action, for example we need to check our free space on the storage and create backup. We divide screen and in the delay with 2 seconds monitor changes.
Conclusion
The screen utility in Linux offers a powerful and efficient way to manage multiple virtual terminals within a single terminal window. It consists of two essential components—the terminal session that acts as a container for virtual terminals and the terminal multiplexer responsible for managing these terminals. With screen, IT specialists can streamline their workflow by creating and organizing multiple terminals, switching between them, and even dividing the screen for complex tasks.