What is Screen? | How to Use Screen Command in Linux | Attached and Detached Screen
How to Use screen command, attached and detached screen |
Screen is a utility that give us a virtual terminals means its allow us to resume the session during we want to perform long-running task and suddenly connection drops or session terminated.
In simplicity we can say that screen utility allow as to attach and detch screen session during a long task without any lose of work.
To install Screen in Linux
We can easily install screen utility by "screen" package in Debian and CentOS/Rhel/Fedora
Ubuntu and Debian
CentOS/RHEL and Fedorasudo apt updatesudo apt install screen
After Successfully Installed utility we can check all available option the the following command
To Help of Screen
screen -h
To start Screen
screen
It will open a new session in same terminal, we can get list of command by Press
Ctrl + A together then press ?
We can check screen session by -ls option
screen -ls
To start Screen with define screen name
screen -S myscreen
Here is xxxx.myscreen is defined with the help of -S option, both screen is attached mode.
In this example we open 2 screen session, first "4278.pts-0.lokesh" then open "4359.myscreen" both is Attached mode and ready for running a long-running task.
Now we will dettached screen so we can resume later.
To Detached screen
Press Ctrl + a then press d
It will give a display something like [detached from 4278.pts-0.lokesh]
To Resume Or Attached screen
screen -r <screen name>screen -r pts-0.lokesh
Below are some most commands for managing Screen
Ctrl+a c Create a new window in screen
Ctrl+a " List all open windows
Ctrl+a 0 Switch to active windows by number 0...9
Ctrl+a A Rename the current window
Ctrl+a S Split current region horizontally into two regions
Ctrl+a | Split current region vertically into two regions
Ctrl+a tab Switch the input focus to the next region
Ctrl+a Q Close all regions but the current one
Ctrl+a X Close the current region
Ctrl+a c Create a new window in screen
Ctrl+a " List all open windows
Ctrl+a 0 Switch to active windows by number 0...9
Ctrl+a A Rename the current window
Ctrl+a S Split current region horizontally into two regions
Ctrl+a | Split current region vertically into two regions
Ctrl+a tab Switch the input focus to the next region
Ctrl+a Q Close all regions but the current one
Ctrl+a X Close the current region
Thanks
Leave a Comment