Screen Tips
From ArchWiki
GNU Screen is a wrapper that allows separation between the text program and the shell from which it was launched. This allows the user to, for example, start a text program in a terminal in X, kill X, and continue to interact with the program. Here are a couple of tips and tricks you may be interested in.
Contents |
[edit] Basics
Commands are entered pressing Control A and then the key binding. The escape key can be changed with the escape option in ~/.screenrc. IE:
escape ``
sets the escape key to `
[edit] Common Commands
C-a 0
- opens window 0
C-a A
- Rename the current window
C-a c
- Create a new window (with shell)
C-a S
- Split current region into two regions
C-a <TAB>
- Focus on next region
C-a <ESC>
- Enter Copy Mode (use enter to select a range of text)
C-a ]
- Paste text
C-a Q
- Close all regions but the current one
[edit] Start at window 1
By default, the first screen window is 0. If you'd rather never have a window 0 and start instead with 1, put something like the following in your ~/.screenrc:
bind c screen 1 bind 0 select 10 screen 1 select 1
[edit] Fix for residual editor text
When you open a text editor like nano in screen and then close it, the text may stay visible in your terminal. To fix this, put the following in your ~/.screenrc:
altscreen on
[edit] Use 256 colors
By default, screen uses an 8-color terminal emulator. Use the following line to enable more colors, which is useful if you are using a more-capable terminal emulator:
term screen-256color
[edit] Use 256 Colors with Rxvt-Unicode (urxvt)
If you are using rxvt-unicode-256color from the AUR you may need to add this line in your ~/.screenrc to enable 256 colors while in screen.
terminfo rxvt-unicode 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
[edit] Informative statusbar
The default statusbar may be a little lacking. You may find this one more helpful:
hardstatus off
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W}%c %{g}]'
[edit] Turn welcome message off
Cause it's annoying. Add to ~/.screenrc:
startup_message off