How to Use Linux Screen Command With Examples
Table of Contents
Use Linux Screen Command With Examples
The screen command in Linux is used creating terminal multiplexing. By using screen you can run any number of the terminal-based applications. Screen command can enable you to resume your work where the last time you exited the application. Users can open multiple instances of terminal inside one single terminal by using screen command very easily. If you exit the terminal then the process running in the terminal will not break it will be continued in the background so you can resume the session where you left. In this tutorial, you are going to learn How to Use Linux Screen Command With Examples.
Installing Linux Screen
First, confirm whether the
screen command is installed or not on your system run following command:
You can install a Linux screen using the following command in different Linux distros.
screen command in Ubuntu, Debian or any Debian based distro run following command:
sudo apt install screen
screen command in CentOS, RHEL run following command:
sudo yum install screen
For Fedora you can type the following command:
sudo dnf install screen
Using Linux Screen
You can start a new
screen session by typing following command in terminal:
The output should look like the following:
Now to get the list of available commands by typing
? in the current terminal.
Create New Session With Name
You create a new session with a specific name by using screen command with
screen -S NAME_OF_THE_SESSION/pre> You can replace
NAME_OF_THE_SESSIONwith the name you want to give to a new session.
Detach From Screen Session
You have created a new session you can also detach from the session. To detach from the session enter the following keys:
The output should look like:
Re-Attach to a Linux Screen Session
You can re-attach to a previous screen session by using
-r option with screen command.
To re-attach to a new session run below Linux screen command:
If you have created multiple screen sessions then it will list you all the sessions available, then you should choose one of them and should run the following command:
screen -r 7582
After running above command you will be attached to a session with ID
List All Available Sessions Using Screen Command
You can also list all available sessions using
-ls option with Linux screen command:
The output should look like:
There are screens on: 7582.second_session (Detached) 7412.new_session (Detached) 7105.pts-1.localhost (Detached) 3 Sockets in /run/screen/S-linux4one.
You have successfully learned How to Use Linux Screen Command With Examples. If you have any of the queries regarding this then please don’t forget to comment below.
How to Install VirtualBox on Ubuntu 18.04
How to set up Cron Job on Debian 9
How to Install Google Chrome on Ubuntu 18.04
How to Create Symbolic Links Using ln Command in Linux
Secure Nginx with Let’s Encrypt SSL on Ubuntu 18.04
How to Install Sublime Text 3 on Debian 9
How to Install CMake on Linux Mint 19
How to install phpMyAdmin on Ubuntu 18.04
How to Install and Use Docker on Debian 9
How to Install DataGrip on Fedora 29
How to Install Kodi on Debian 10
How to Save a File in Vim or Vi and Quit the Editor