When using screen in linux, how can I tell if I\'m in a screen or not?
I could do exit
and I\'ll exit a screen if I was in one, but if I wasn\'t, then I\'ll end
My solution to the problem is a lot simpler: just hitting TAB makes the full terminal blink (a quick video inversion) if you are inside GNU Screen.
Tested working on most Linux (Ubuntu, Kali, Debian, RaspBerry... etc) and FreeBSD, GUI and any terminal, local or remote, including CtrlAltFn ones.
As an exception for this method, please, note this (rather complex, but possible) case scenario:
screen -S AScr
from remote terminal on computer A.AScr
terminal into Computer B.screen -S BScr
from remote terminal on computer B.You are inside a Screen
on cases 2 and 4, and outside a Screen
on cases 1 and 3, but the terminal will blink on cases 2, 3 and 4.