Screen pres
From FOSUG
Contents |
Follow along
Connect to test session and play.
ssh doteltech.com -l fosug pw: 45!jaM00t
Connect to test session and play
Why Screen
- Allows you to continue running programs after you log off.
- Better use of limited screen space.
- Daemonize non daemon programs.
- Sharing a console
- It's just darn fun.
Basic commands
- Start Commands:
- “screen” - Start new session
- “screen -x” attach to session in progress
- “screen -m 'program'” - Start 'program' in screen
- “screen -dm 'program'” - Start program and detach
Navigation inside screen
Screen requires you get it's “attention” before issuing commands. This is done by:
C-a (CTRL-a) - Grab “Attention”
After you have it's attention, you can issue additional commands.
- C-a + ? = List commands
- C-a + c = Create new screen.
- C-a + d = Detach from screen.
- C-a + l = Redraw screen.
- C-a + k = Kill Active screen.
- C-a + n = Next screen.
- C-a + p = Previous Screen.
- C-a + A = Rename Session.
- C-a + “ = List sessions.
- C-a + S = Split screen.
- C-a + tab = move between windows.
- C-a + x = Lock screen.
Spit the screen
- Navigating
- Creating
- Killing
screen.rc
- Example 1 - each tab will have a number, a name plus time and date
hardstatus alwayslastline
hardstatus string '%{= mK}%-Lw%{= KW}%50>%n%f* %t%{= mK}%+Lw%< %{= kG}%-=%D %d %M %Y %c:%s%{-}'
- Example 2 - tabs that will be created in the center and the active tab will be highlighted in red and also have the hostname displayed.
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m%{W}%c %{g}]'
- Example 3 - same as example 2 and additionally display the processor usage
hardstatus alwayslastline hardstatus string '%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%?%?%= %{g}][%{Y}%l%{g}]%{=b C}[ %m/%d %c ]%{W}'
Things to remember
- Nested screens can be confusing
- Security of ROOT
- Care of how you become "root"