This article is a quick guide to installing screen in Amazon Linux 2. Screen allows you to open up multiple terminal sessions and detach from them so that they are still running even if you disconnect or log out of your shell.
What is screen?
Screen is a tool for multiplexing terminal sessions. It allows for the screen to be opened, accessed, and closed at any time without losing what is being done in screen.
- Screen will allow you to open up a session even if you have logged out of your shell or disconnected from it
- You can detach from screen as well so that it stays running
How to install screen in Amazon Linux 2
Installing screen is as easy as using the yum package manager, which is used for managing packages on Amazon Linux 2. At first login to your EC2 instance using terminal or Putty. The following command will install screen
sudo yum install screen -y
To check if the installation worked fine, please run this command
Why should I use it?
Screen is used to keep terminals open so that they can be accessed later on without having to reconnect or login again. Screen allows you to run commands for hours if needed without any interruptions because it works as a window manager. So using screen you can run some background tasks without even logging into your server.
Screen commands overview
There are a few important commands in screen which you should know about.
This will list all active screen sessions.
To start a new screen session with a name, type this command
screen -S atiq
To enter the screen session run this command.
To list down all the screen IDS, please run this command
screen -x with no parameter is used for suspending an existing screen session and finally pressing d to detach from it.
Examples of how you can use screen and when not to use it
Here I list below some examples of screen usages and when screen should not be used.
It’s time to get your screen working in Amazon Linux 2. In this quick guide, we will walk you through the process of installing a Screen package on Amazon Linux 2 and show you how it works with some basic example usage commands. Subscribe to our YouTube channel for more details!
Interested more in Linux? Please check out my other articles below.
Setup SWAP in Linux