How to list running screen sessions on Linux?

Screen (also known as GNU Screen) is a terminal multiplexer that allows you to start a screen session and open multiple windows within that session. A key advantage is that processes running in Screen continue to execute even when their window is not visible or when you disconnect from the session.

Installing Linux Screen

If the screen package is not already installed on your Linux distribution, you can install it using the appropriate command for your system.

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 new screen session by typing the following command in your terminal −

screen

Listing Running Screen Sessions

To view all active screen sessions for the current user, use the following command −

screen -ls

This command displays a list of all detached and attached screen sessions along with their session IDs and status information.

Listing All Screen Sessions System-wide

If you want to see all screen sessions on the machine (for all users), you can examine the /var/run/screen/ directory −

ls -laR /var/run/screen/

Example 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 ..

Common Screen Commands

Command Description
screen -ls List all screen sessions for current user
screen -r [session_id] Reattach to a detached session
screen -d [session_id] Detach a session
screen -S [name] Start a new named session

Conclusion

The screen -ls command is the primary method for listing running screen sessions for the current user, while examining /var/run/screen/ provides system-wide visibility. Screen is invaluable for maintaining persistent terminal sessions that survive disconnections and system reboots.

Updated on: 2026-03-17T09:01:38+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements