screen -ls does not seem to indicate how many connections I have using screen -x (multi display mode).


screen     # create first screen
screen -ls
screen -x  # attach to first screen from a different location
screen -ls 

Both screen -ls commands show the exact same info. There's no indication that there is now 2 attachments to the same screen. Is there a way to show this?

1 Answer 1


screen -ls will not list it, but you can find out the number of attached screens by looking at the pts devices created for the master process.

The script below will add a number to the end of screen -ls with the number of attached screens:


screen -ls | while read scr
    if [[ "$scr" =~ ^[0-9]+\. ]]; then
        cnt=$(ls -l /proc/$pid/fd/ | grep pts | wc -l)
        echo "$scr [$cnt]"
        echo "$scr"
  • This is an amazing answer! Thank you, it worked perfectly! The key to this is ls -l /proc/$pid/fd/ | grep pts, where $pid is the pid for screen if you want to see how it works.
    – wisbucky
    Commented Feb 14, 2020 at 18:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .