Recent Posts


« My Favorite Sunset Photo | Main | Green Thumb Sunday: Blackberry Flowers »

How-To: Detach Sessions in Screen

By Eaglehawk | May 10, 2008

This entry is part 2 of 2 in the series How-To

ifconfig
Creative Commons License photo credit: slashcrisis

Recently I have been running a script on one of my servers that has been taking longer than I can sit at a laptop. So I decided I use screen to run the program that way I could leave the session running after I left the system. I found once you are in screen it does not matter how many screen sessions you have open; you can use CTRL+A followed by D to detach your screen without closing it.

Some screen important keys quick reference:
CTRL+A + 0-9 – Change which screen session you are using.
CTRL+A + C – Open a new screen session.
CTRL+A + D – Detach without closing your sessions.

Screen allows you to customize it’s view. This is what I have in my .screenrc

hardstatus on
hardstatus alwayslastline
hardstatus string “%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a “

# see http://www4.informatik.uni-erlangen.de/~jnweiger/screen-faq.html
# support color X terminals
termcapinfo xterm|xterms|xs|rxvt ti@:te@
termcap xterm ‘XT:AF=\E[3%dm:AB=\E[4%dm:AX'
terminfo xterm 'XT:AF=\E[3%p1%dm:AB=\E[4%p1%dm:AX'
termcapinfo xterm 'XT:AF=\E[3%p1%dm:AB=\E[4%p1%dm:AX:hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007′
termcap xtermc ‘XT:AF=\E[3%dm:AB=\E[4%dm:AX'
terminfo xtermc 'XT:AF=\E[3%p1%dm:AB=\E[4%p1%dm:AX'
termcapinfo xtermc 'XT:AF=\E[3%p1%dm:AB=\E[4%p1%dm:AX:hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007′

all of the termcapinfo xtermc lines should be one line. Not really sure why it’s doing this.

Hope this helps others that are looking for help with this.

2b1b4cdc9f1caa67d340f77cd52cc4d3 How-To: Detach Sessions in Screen
Series Navigation«How-To: DMCA Notices

Categories: Linux
Technorati Tags: ,

Comments

Because I have problems with comment spam, your comment may not show up right away.