How can I tell whether I'm in a screen?

后端 未结 9 1700
悲哀的现实
悲哀的现实 2020-12-07 18:11

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

9条回答
  •  执笔经年
    2020-12-07 18:52

    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:

    • 1.- SSH into computer A (lets assume Linux).
    • 2.- Enter a new screen -S AScr from remote terminal on computer A.
    • 3.- SSH from GNU Screen AScr terminal into Computer B.
    • 4.- Enter a new 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.

提交回复
热议问题