[email protected]Support 24/7 · Billing 09:00 – 00:00LinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedJuly 24, 2023

How to use shortcuts for screen command.

How To Use Shortcuts For Screen Command.

What is screen comand?

At its core, screen is a terminal multiplexer. It enables users to open multiple virtual terminals within a single physical terminal or remotely accessed terminal. With screen, you can start long-running processes, keep them running even if your connection drops, detach from the sessions, and later reattach to them from another location.

In most Linux OS screen are preinstalled. If it’s not installed you need to install manually:

  • Use the package manager of your Linux distribution to install screen. For example, on Ubuntu, you can use the following command: sudo apt-get install screen.
  • On Red Hat Enterprise Linux (RHEL) or CentOS, you can use: sudo yum install screen or sudo dnf install screen.
  1. Basic Usage of screen

To initiate a new screen session, simply type:

screen

This will create a new virtual terminal, and you can start working as you would in a regular terminal. To exit the session, press Ctrl + A followed by D. This detaches you from the session, allowing it to keep running in the background.

  1. Reattaching to screen Sessions

After detaching from a screen session, you can later reattach to it and resume your work. To list all available screen sessions, execute:

screen -ls

The output will display a list of available sessions along with their unique session IDs. To reattach to a specific session, use:

screen -r session_id
  1. Naming screen Sessions

By default, screen sessions are identified by session IDs, which can be cumbersome to remember. To make your life easier, you can give meaningful names to your sessions using the -S flag when starting a new session. For example:

screen -S my_session

Now, you can reattach to this session by using its name instead of the session ID:

screen -r my_session
  1. Managing Multiple Windows

Within a single screen session, you can create and manage multiple terminal windows, each functioning independently. To create a new window, press:

Ctrl + A, C

To switch between different windows, use:

Ctrl + A, N (Next window)
Ctrl + A, P (Previous window)

If you want to switch directly to a specific window, press:

Ctrl + A, <number>
  1. Closing Windows

To close the current window, type exit. Be cautious as this only closes the window but not the underlying process. The process will continue running in the background.

  1. Splitting the Screen

One of the most useful features of screen is the ability to split the terminal window into multiple regions, displaying different terminal sessions simultaneously. To split the screen vertically, use:

Ctrl + A, |

To split the screen horizontally, use:

Ctrl + A, S

Switch between split screen regions by pressing:

Ctrl + A, Tab
  1. Copy and Paste

screen also allows you to copy and paste text between different windows within a session. To enter copy mode, press:

Ctrl + A, [

Use the arrow keys or the vi editor keybindings to navigate and select the text. To copy the selected text, press Enter. To paste the copied text, press:

Ctrl + A, ]
  1. Exiting screen Sessions

To exit a screen session, ensure that all windows within the session are closed. Then, type:

exit

This will terminate the screen session.

 

Conclusion:

The Linux screen command is a powerful tool that enhances terminal multitasking and remote server management. By mastering the various features and shortcuts of screen, you can boost your productivity and efficiently manage multiple terminal sessions. Whether you are a system administrator, developer, or power user, screen is a valuable addition to your Linux toolkit. So, start exploring the capabilities of screen and unlock the true potential of the Linux command line.

Keep reading
How to understand symbolic link and their use.
March 16, 2023

How to understand symbolic link and their use.

How To Understand Symbolic Link And Their Use. A symlink or a Symbolic Link is simply enough a shortcut to another file. It is a file that points to another file. They may sound a little complex, but they’re really not, you can think of symlinks as shortcuts. To create a symbolic link you use…

Read article
How to Show Line Numbers in Vim / Vi.
March 16, 2023

How to Show Line Numbers in Vim / Vi.

How To Show Line Numbers In Vim / Vi. This article will show you how to display or hide line numbers in Vim / Vi text editor. Vim/Vi is the text editor of choice for many software developers and Linux system administrators. By default, Vim doesn’t show line numbers, but they can be easily turned…

Read article
How to Add User to Sudoers in Ubuntu
March 16, 2023

How to Add User to Sudoers in Ubuntu

How To Add User To Sudoers In Ubuntu In this article we’ll show you two ways to grant sudo privileges to a user. The first one is to add the user to the sudoers file . This file contains information that controls which users and groups are granted with sudo privileges, as well as the…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, cloud hosting, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Support 24/7 · Billing 09:00 – 00:00