How to get current screen session name (bash)? I need implement it in Python, so would be much more better just command without Ctrl combinations.
I know way with screen -ls | grep 'Attached'
but it's not elegant and sometimes not correct
How to get current screen session name (bash)? I need implement it in Python, so would be much more better just command without Ctrl combinations.
I know way with screen -ls | grep 'Attached'
but it's not elegant and sometimes not correct
Screen stores the session name in the env var STY
. So you can access it as os.environ['STY']
>>> import os
>>> os.environ['STY']
'17136.pts-3.suni-lnx'