How to use Screen command in Linux

Have you ever moon-faced true wherever you perform a long-running task on an overseas machine, and suddenly your association drops, the SSH session is terminated, and your work is lost. Well, it’s happened to all or any folks at some purpose, hasn’t it? fortuitouslythere’s a utility referred to as screen that permits us to resume the sessions.

Introduction

Screen or antelope Screen may be a terminal electronic device. In different words, it implies that you’ll be able to begin a screen session and so open any range of windows (virtual terminals) within that session. Processes running in Screen can still run once their window isn’t visible notwithstanding you get disconnected.

How to Install Screen

Well in most of the linux operating systems it comes pre-installed

You can check it’s version by typing

screen --version 
Screen version 4.06.02 (GNU) 23-Oct-17

If you don’t have screen put in on your system, you’ll be able to simply install it using the package manager of your distro.

Install Linux Screen on Debain Based OS

sudo apt update
sudo apt install screen

Install Linux Screen on RHEL Based OS

sudo yum install screen

How to start linux Screen

To start a screen session, simply type screen in your console:

screen

This will open a screen session, produce a replacement window, and begin a shell in this window.
Now that you simply have opened a screen session, you’ll get a listing of commands by typing:

Ctrl+a ?

Starting session with name

Named sessions ar helpful after you run multiple screen sessions. to form a named session, run the screen command with the subsequent arguments:

screen -S session_name

It’s continually a decent plan to settle on a descriptive session name.

Working with UNIX system Screen Windows

When you begina brand new screen session, it creates one window with a shell in it.

You can have multiple windows within a Screen session.

To create a replacement window with shell type Ctrl+a c, the primaryout thererange from the vary0…9 are going to beassigned to that.
Below area unit some most typical commands for managing UNIX operating system Screen Windows:

  • Ctrl+a c produce a replacement window (with shell).
  • Ctrl+a ” List all windows.
  • Ctrl+a zero Switch to window zero (by number).
  • Ctrl+a A Rename the present window.
  • Ctrl+a S Split current region horizontally into 2 regions.
  • Ctrl+a | Split current region vertically into 2 regions.
  • Ctrl+a tab Switch the input focus to future region.
  • Ctrl+a Ctrl+a Toggle between the present and former windows
  • Ctrl+a q shut all regions however the present one.
  • Ctrl+a X shut the present region.

Detach from Linux screen session

You can detach from the screen session at any time by typing:

Ctrl+a d

The program running within the screen session can still run once you detach from the session.

Reattach to a Linux operating system Screen

To resume your screen session use the subsequent command:

screen -r

In case you’ve got multiple screen sessions running on your machine, you maygot to append the screen session ID once the r switch.

To find the session ID list this running screen sessions with:

screen -ls

If you wish to revive screen 10835.pts-0, then sort the subsequent command:

screen -r 10835

Conclusion

In this tutorial, you learned a way to use wildebeest Screen. currently you’ll be able to begin exploitation the Screen utility and build multiple screen windows from one session, navigate between windows, detach

There’s tons additional to be told concerning wil de best Screen at Screen User’s Manual page.

One comment

Leave a Reply