Today, I explored how to use the screen
command on Linux. If you often work on remote servers, this tool can be a game-changer.
Imagine starting a huge data transfer or running a long installation script on some remote server. Only to be disconnected halfway through because your SSH session was idle. Why? Well, it's because:
SSH allows [server] administrators to set an idle timeout interval. After this interval has passed, the idle user will be automatically logged out.
ENTER screen
screen
is an invaluable tool that provides terminal multiplexing. In simple terms, it lets you run multiple terminal sessions in one window and, more importantly, allows you to detach from and later reattach to terminal sessions.
Here's a simple guide to using the screen
:
Installing screen
:
-
Ubuntu/Debian:
sudo apt-get update sudo apt-get install screen
-
Fedora:
sudo dnf install screen
-
CentOS/RedHat:
sudo yum install screen
-
Arch Linux:
sudo pacman -S screen
-
openSUSE:
sudo zypper install screen
Usage
Here's a simple guide on using screen
:
-
Start a session: Use the command
screen
. If you want to find it later, give it a name:screen -S yourname
. -
Leave the session: Press
CTRL
+A
thenD
. Your work keeps running even if you're not watching. -
See your sessions: Type
screen -ls
. This shows any sessions you have running. -
Get back to a session: Use
screen -r SessionID
. If you named it, usescreen -r yourname
.
Final words
Using screen
has made it easier to keep working even if my remote connection drops. It's a useful tool to keep things running smoothly.
Follow me on Twitter (@daryllukas) for more Linux tips like this.
Top comments (0)