СHRISTMAS
WHEEL OF FORTUNE

Tap the button and win a guaranteed prize right now!

By registering, you are signing up to receiving e-mails.
JT
August 14 2023
Updated August 14 2023

Screen in Ubuntu. Linux screen command

Monitoring Ubuntu

Introduction

One of the main requirements for any ITspecialist 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 commandline 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:

apt update && apt upgrade -y
Updating packages
Screenshot №1 — Updating packages

After update and upgrade system we need to install needed package of screen utility, that can help to work with different screens:

sudo apt-get install screen
Installation
Screenshot №2 — Installation

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 utilitytype command syntax screen, you will see the hellomessage:

screen
Hello message
Screenshot №3 — Hello message

Press Space or Return to skip popup 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:

Ctrl+a+c
Ctrl+a+S
Split screen
Screenshot №4 — Split screen

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:

Ctrl+a+Tab

And switch needed virtual terminal by combination for previous and next terminal accordance:

Ctrl+a+n and Ctrl+a+p

Also you can displayed on the screen list of th terminal windows:

Ctrl+"
List of windows
Screenshot №5 — List of windows

If you want to see shorter info about it type:

Ctrl+a+w
Shorter list
Screenshot №6 — Shorter list

For more clearness usage that windows, you can change label of every window, by pressing:

Ctrl+a+Tab

Switch at the needed window and press bundle of keys:

Ctrl+a+A
rename
Screenshot №7 — Rename

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:

Ctrl+a+|

Also you can divide more complex, let's separate right area by the command below:

Ctrl+a+S
Multi split
Screenshot №8 — Multi split

At the start you will have no active window slide them as we described before:

Ctrl+a+p or n

For killing one process use combination:

Ctrl+a+k

For all bundle of virtual window:

Ctrl+a+\

And agree with close statement in the popup line. But if you want just minimize window of virtual terminal then you need to type:

Ctrl+a+Q

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:

Ctrl+a+d

And attached again by searching needed line:

screen -ls

And type their ID in the command below:

screen -r 23505

For get more information about combination to use, you can press:

Ctrl+a+?
help
Screenshot №9 — Help

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.

usage
Screenshot №10 — Usage

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

Vote:
5 out of 5
Аverage rating : 5
Rated by: 1
33145 North Miami, FL 2520 Coral Way apt 2-135
+1 302 425-97-76
700 300
ITGLOBAL.COM CORP
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.