How to list running screen sessions on Linux?

LinuxOperating SystemOpen Source

Screen or sometimes also known as GNU Screen, is a terminal multiplexer. What it means is that it allows you the privilege to start a screen session and then open any number of windows inside that session.

It might also be interesting to note that a process that is running in Screen will continue to run even when their window is not visible anymore.

Installing Linux Screen

In order to install the screen package if it is not already present on your Linux distribution, you can run any of the suitable commands shown below for your machine.

For Ubuntu and Debian

sudo apt update
sudo apt install screen

For CentOS and Fedora

sudo yum install screen

Starting Screen

You can start a screen session by typing the command shown below in your terminal.

screen

Now we know how to install a screen and make use of it, the following command shown below will list all of the screen sessions for a user.

Command

screen -ls

In case you want to see all screen session on a specific machine you can do −

ls -laR /var/run/screen/

Output

immukul@192 ~ # ls -laR /var/run/screen/

/var/run/screen/:
total 1
drwxrwxr-x 4 root utmp 96 Feb 1 2020 .
drwxr-xr-x 10 root root 840 Feb 1 03:10 ..
drwx------ 2 immukul users 88 Feb 13 11:33 R-immukul
drwx------ 2 root root 48 Feb 11 10:50 R-root

/var/run/screen/R-immukul:
total 0
drwx------ 2 immukul users 88 Jan 13 11:33 .
drwxrwxr-x 4 root utmp 96 Mar 1 2020 ..
prwx------ 1 immukul users 0 Feb 11 10:41 12931.pts-0.gentle

/var/run/screen/R-root:
total 0
drwx------ 2 root root 48 Feb 13 10:50 .
drwxrwxr-x 4 root utmp 96 Mar 31 2019 ..
raja
Published on 30-Jul-2021 09:01:46
Advertisements