basics

  1. To start a new sub session (Virtual Session) type
    ((ctrl+a) c)
    Please ignore the plus (+)symbol, this essentially means “ctrl a then c”
  2. To switch between sessions…
    ((ctrl+a) <space bar>)
  3. To switch between your previous session and the current one..
    ((ctrl+a) a)
  4. To kill a frozen session…
    ((ctrl+a) k)
  5. To see a list of available commands…
    ((ctrl+a) ?)
  6. To see a list of virtual terminals you have open..
    ((ctrl+a) “)
  7. To Detach from a screen session and not lose any of your virtual terminals…
    ((ctrl+a) d) ( This is one of the best features of screen!! )
  8. To enter copy/scrollback mode.
    ((ctrl-a) [) or
    ((ctrl-a) ctrl-[) or
    ((ctrl-a) esc)
    !! See ~/.screenrc !!
  9. To view current screen sessions once you are logged out of screen..
    “screen -list”
  10. To reattach to an Attached session (Session that was not detached properly)
    “screen -D -r <11546.pts-5.hostname>” (session name from the output of the screen -list command)
  11. To reattach to a detached session..
    “screen -r <11546.pts-5.hostname>” (session name from the output of the screen -list command)
  12. To end that session you can either type
    “exit” or a (ctrl+d)

screen logging

((ctrl-a) H)
sometimes it’s important to keep track of what I do to some servers. this is very easy with screen.
((ctrl-a) H) creates an ongoing logging of the session.
screen will start capature through multiple sessions.
very useful for capturing what you have done…
manpage says: Begins/ends logging of the current window to the file “screenlog.n”
You can also use ‘screen -L …‘ when starting screen to activate session logging.

~/.screenrc

# Enable mouse scrolling and scroll bar history scrolling
# This will enable scrolling in terminal, but you will
# only be able to see output of running commands since you
# connected to screen and scroll using your mouse wheel.
# To see earlier output of running commands, you can still
# use the ((ctrl-a)esc) shortcut in screen sessions.
termcapinfo xterm* ti@:te@

# set scrollback lines
scrollback 10000

Leave a Reply