0

How to get only the session names in screen -ls?

0

1 Answer 1

-1

Maybe with parsing the outpout?

For unnamed sessions:

$ screen -ls | grep -oP '\d+\.[\d\w-]+\.[\w\d]+'
4889.pts-0.myhostname

For named sessions:

$ screen -ls | grep -oP '\d+\.\S+'
14819.namedsess
14678.with1.num

To gather the name only:

$ screen -ls | grep -oP '\d+\.\S+' | grep -oP '(?<=\d\.)\S+'
namedsess
with1.num

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