[email protected]Office hours: Mon – Fri 9:00AM – 5:00PMLinkedInXFacebook
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 Implement Network Segmentation and Resource Isolation in Linux.
February 6, 2024

How to Implement Network Segmentation and Resource Isolation in Linux.

How to Implement Network Segmentation and Resource Isolation in Linux. Securing and managing networks in a Linux environment involves advanced practices like network segmentation and resource isolation. This guide explores these concepts, providing detailed instructions and examples for…

Read article
How to open or close ports in Linux.
February 6, 2024

How to open or close ports in Linux.

How to open or close ports in Linux. Effectively managing ports on your Linux system is crucial for both security and service accessibility. This comprehensive guide will provide a detailed walkthrough on opening and closing ports using the robust tools iptables and ufw. Understanding these…

Read article
How to use ypdomainname command.
January 23, 2024

How to use ypdomainname command.

How to use ypdomainname command. In the realm of Linux networking, the ypdomainname command plays a crucial role in the context of the Network Information Service (NIS). NIS, formerly known as Yellow Pages, is a distributed database service that facilitates the sharing of network configuration and…

Read article
Get in Touch

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

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

Get Started →Contact Us
[email protected]Office hours: Mon – Fri 9:00AM – 5:00PM