How to know if I am in a screen of a screen?
I know how to see if I am in a screen: I have made an alias alias inscreen = 'echo $STY'
.
But earlier today, I accidently type screen
inside a screen
without noticing it and in some way it made me make a mistake later.
Things I’ve observe when I type screen
(inner screen) inside a screen
(outer screen):
screen -ls
only shows 1 result related to that screenecho $STY
is the same in both inner and outer screenctrl + A
andctrl + D
can detach from the inner screen to no screen, but whenscreen -r
back, both inner screen and out screen exist- now I can
exit
twice: inner screenexit
-> outer screenexit
So my question is, is there anyway I could know I am in a screen of a screen?
P.S. When type screen
for the first time, it will pop some text:
if type screen
inside a screen
, it won’t show these hints.
From @geirha, a bash guru from libra irc #bash:
if you run ”screen” inside a screen, you open a new window in that screen. It does not start a nested screen.
so typing screen
inside a screen, I am opening new windows.
you can switch between the windows with
ctrl+a n
andctrl+a p
also, try ctrl+a :
caption always
this would show a status bar indicating which window you are current in.
Also:
put
caption always "%{ Mk}%-w%{ Wk}%n %t%{ Mk}%+w"
in~/.screenrc
would have a cool status bar every time you enter screen
:
(Format specifiers customizing how the caption will look. See STRING ESCAPES in man screen)
Ctrl+a :
title "hello world"
https://www.gnu.org/software/screen/manual/screen.html#Title-Command