screen command is a nice program for us to run process background, but I found Ctrl + a w do not show screen windows list in xshell(Xmanager component) and Ctrl + a k do not kill this screen terminal for me. However Ctrl + a d to dettach session works! So what's wrong with Ctrl +a w to list sessions?

More serious, How do I know whether I am in screen window or normal bash window? Many times I try to dettach screen session, I got logout after ctrl+a d. Very embarrassing isn't it? So is there any hints to show me whether am I in a screen window or just normal tty terminal?

migrated from serverfault.com Dec 29 '14 at 13:18

This question came from our site for system and network administrators.


If you're getting logged out when you type ^A d I'm guessing you're still holding down the control key when you're pressing d. ^A ^D is bound to "detach" as well as ^A d. For ^A k and ^A w, try letting go of the control key before pressing the k or the w.

  • My fault! control key shoud not be holded when w or d ispressed. thx~ – seanlook Dec 30 '14 at 1:24

Probably the combination ^A w is used by something with higher priority. ^A d is probably not used by it and thus passed to screen. You can try setting a different command character with -e.

^A d should not log you out from a normal shell.

My advice is to always press ^A w before ^A d when unsure. To make it completely safe you may use the shell's key binding feature to react to it, e.g. print this is not within screen.


I also found myself tricked by this. Ever since, I always add these two lines to screenrc:

hardstatus alwayslastline
hardstatus string "%{= kG}[ %{G}%H %{g}][ %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]"

It changes the visual appearance of a TTY in screen. You cannot overlook it afterwards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.