<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BigSmoke &#187; Screen</title>
	<atom:link href="http://blog.bigsmoke.us/tag/screen/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.bigsmoke.us</link>
	<description>Smokes your problems, coughs fresh air.</description>
	<lastBuildDate>Sat, 04 Feb 2012 18:03:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Xen console</title>
		<link>http://blog.bigsmoke.us/2010/01/31/xen-console</link>
		<comments>http://blog.bigsmoke.us/2010/01/31/xen-console#comments</comments>
		<pubDate>Sun, 31 Jan 2010 18:15:44 +0000</pubDate>
		<dc:creator>halfgaar</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Screen]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=1126</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>
To get the console of your Linux guests on a Xen machine, type &#8220;xm console <name>&#8220;. Then to exit, press &#8220;ctrl-]&#8221;. When in screen, do &#8220;ctrl-a, a, ctrl-]&#8221;.
</p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2010/01/31/xen-console/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My custom Linux environment</title>
		<link>http://blog.bigsmoke.us/2010/01/04/my-custom-linux-environment</link>
		<comments>http://blog.bigsmoke.us/2010/01/04/my-custom-linux-environment#comments</comments>
		<pubDate>Mon, 04 Jan 2010 09:54:07 +0000</pubDate>
		<dc:creator>halfgaar</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Screen]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=978</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>
On every machine that I install, I need a custom environment. At the very basic, I need screen and bash customizations. I will attempt to keep this blog post up-to-date with my most recent config.
</p>

<p>
/etc/bash.bashrc_halfgaar (naming scheme depends on distro):
</p>

<pre class="bash"><span style="color: #b1b100;">function</span> prompt_command <span style="color: #66cc66;">&#123;</span>
  <span style="color: #000066;">local</span> <span style="color: #0000ff;">XTERM_TITLE=</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\e</span>]2;<span style="color: #000099; font-weight: bold;">\u</span>@<span style="color: #000099; font-weight: bold;">\H</span>:<span style="color: #000099; font-weight: bold;">\w</span><span style="color: #000099; font-weight: bold;">\a</span>&quot;</span>
&nbsp;
  <span style="color: #000066;">local</span> <span style="color: #0000ff;">BGJOBS_COLOR=</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\[</span><span style="color: #000099; font-weight: bold;">\e</span>[1;30m<span style="color: #000099; font-weight: bold;">\]</span>&quot;</span>
  <span style="color: #000066;">local</span> <span style="color: #0000ff;">BGJOBS=</span><span style="color: #ff0000;">&quot;&quot;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#91;</span> <span style="color: #ff0000;">&quot;$(jobs | head -c1)&quot;</span> <span style="color: #66cc66;">&#93;</span>; <span style="color: #b1b100;">then</span> <span style="color: #0000ff;">BGJOBS=</span><span style="color: #ff0000;">&quot; $BGJOBS_COLOR(bg:<span style="color: #000099; font-weight: bold;">\j</span>)&quot;</span>; <span style="color: #b1b100;">fi</span>
&nbsp;
  <span style="color: #000066;">local</span> <span style="color: #0000ff;">DOLLAR_COLOR=</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\[</span><span style="color: #000099; font-weight: bold;">\e</span>[1;32m<span style="color: #000099; font-weight: bold;">\]</span>&quot;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span> <span style="color: #0000ff;">$<span style="color: #66cc66;">&#123;</span>EUID<span style="color: #66cc66;">&#125;</span></span> == <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span> ; <span style="color: #b1b100;">then</span> <span style="color: #0000ff;">DOLLAR_COLOR=</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\[</span><span style="color: #000099; font-weight: bold;">\e</span>[1;31m<span style="color: #000099; font-weight: bold;">\]</span>&quot;</span>; <span style="color: #b1b100;">fi</span>
  <span style="color: #000066;">local</span> <span style="color: #0000ff;">DOLLAR=</span><span style="color: #ff0000;">&quot;$DOLLAR_COLOR<span style="color: #000099; font-weight: bold;">\\</span><span style="color: #000099; font-weight: bold;">\$</span>&quot;</span>
&nbsp;
  <span style="color: #000066;">local</span> <span style="color: #0000ff;">USER_COLOR=</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\[</span><span style="color: #000099; font-weight: bold;">\e</span>[1;32m<span style="color: #000099; font-weight: bold;">\]</span>&quot;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#91;</span> <span style="color: #0000ff;">$<span style="color: #66cc66;">&#123;</span>EUID<span style="color: #66cc66;">&#125;</span></span> == <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span>; <span style="color: #b1b100;">then</span> <span style="color: #0000ff;">USER_COLOR=</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\[</span><span style="color: #000099; font-weight: bold;">\e</span>[41;1;32m<span style="color: #000099; font-weight: bold;">\]</span>&quot;</span>; <span style="color: #b1b100;">fi</span>
&nbsp;
  <span style="color: #0000ff;">PS1=</span><span style="color: #ff0000;">&quot;$XTERM_TITLE$USER_COLOR<span style="color: #000099; font-weight: bold;">\u</span><span style="color: #000099; font-weight: bold;">\[</span><span style="color: #000099; font-weight: bold;">\e</span>[1;32m<span style="color: #000099; font-weight: bold;">\]</span>@<span style="color: #000099; font-weight: bold;">\H</span>:<span style="color: #000099; font-weight: bold;">\[</span><span style="color: #000099; font-weight: bold;">\e</span>[m<span style="color: #000099; font-weight: bold;">\]</span> <span style="color: #000099; font-weight: bold;">\[</span><span style="color: #000099; font-weight: bold;">\e</span>[1;34m<span style="color: #000099; font-weight: bold;">\]</span><span style="color: #000099; font-weight: bold;">\w</span><span style="color: #000099; font-weight: bold;">\[</span><span style="color: #000099; font-weight: bold;">\e</span>[m<span style="color: #000099; font-weight: bold;">\]</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\</span>
$DOLLAR$BGJOBS <span style="color: #000099; font-weight: bold;">\[</span><span style="color: #000099; font-weight: bold;">\e</span>[m<span style="color: #000099; font-weight: bold;">\]</span>&quot;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000066;">export</span> <span style="color: #0000ff;">PROMPT_COMMAND=</span>prompt_command
&nbsp;
<span style="color: #000066;">export</span> <span style="color: #0000ff;">EDITOR=</span>vim
&nbsp;
<span style="color: #000066;">alias</span> <span style="color: #0000ff;">ls=</span><span style="color: #ff0000;">'ls --color=auto'</span>
<span style="color: #000066;">alias</span> <span style="color: #0000ff;">ll=</span><span style="color: #ff0000;">'ls -l'</span>
<span style="color: #000066;">alias</span> <span style="color: #0000ff;">lh=</span><span style="color: #ff0000;">'ls -lh'</span>
<span style="color: #000066;">alias</span> <span style="color: #0000ff;">grep=</span><span style="color: #ff0000;">'grep --color=auto'</span></pre>

<p>
Don&#8217;t forget to source the file in ~/.bashrc
</p>

<p>
~/.screenrc:
</p>

<pre class="php">caption always <span style="color: #ff0000;">&quot;%{= kB}%-Lw%{=s kB}%50&gt;%n%f* %t %{-}%+Lw%&lt;&quot;</span>
vbell off
startup_message off
term linux</pre>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2010/01/04/my-custom-linux-environment/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GNU Screen within Screen within [...]</title>
		<link>http://blog.bigsmoke.us/2009/01/11/gnu-screen-within-screen</link>
		<comments>http://blog.bigsmoke.us/2009/01/11/gnu-screen-within-screen#comments</comments>
		<pubDate>Sun, 11 Jan 2009 19:23:02 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Screen]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=233</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>GNU Screen is great. So great that I find myself always using it. (Pressing the Window key and T launches an <a href="/tag/xterm">XTerm</a> with a new Screen ready on my system, while I have to add Shift if I don&#8217;t want the screen.) This means that when I login into a some other machine through SSH&#8212;an occasion for which Screen is particularly useful&#8212;I will often end up with nested screens. So which Screen will receive my <kbd>Ctrl+a</kbd> presses?</p>

<p>The answer (courtesy of <a href="http://www.google.com/search?q=nested+screens">Google</a> and <a href="http://djkthx.blogspot.com/2007/10/nested-screen-sessions-rule.html">Yacin Nadji</a>) is that <kbd>Ctrl+a</kbd> will target the outer screen. Each <kbd>a</kbd> that you add after that will go down one nesting level.</p>

<p>Not that I don&#8217;t still find controlling nested screen confusing, but now at least I don&#8217;t feel helpless and stuck whenever it happens. <img src='http://blog.bigsmoke.us/wp-factory/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>

<h2>Extra tips</h2>

<ol>

<li>
<p>Visible captions make it easier:</p>
<div id="attachment_234" class="wp-caption alignnone" style="width: 734px"><a href="http://blog.bigsmoke.us/wp-factory/../uploads/2009/01/gnu-screen-within-screen-with-captions.png"><img src="http://blog.bigsmoke.us/wp-factory/../uploads/2009/01/gnu-screen-within-screen-with-captions.png" alt="GNU Screen within Screen with captions" title="GNU Screen within Screen with captions" width="724" height="94" class="size-full wp-image-234" /></a><p class="wp-caption-text">GNU Screen within Screen with captions</p></div>

<p>(If you don&#8217;t know how to configure Screen with captions, I&#8217;ve <a href="http://blog.bigsmoke.us/2008/12/04/gnu-screen-window-captions-as-xterm-tabs">blogged</a> about his previously.)</p>
</li>

<li><cite>Debian Administration</cite>, a very high-quality site has <a href="http://www.debian-administration.org/articles/34">an article</a> about GNU Screen.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2009/01/11/gnu-screen-within-screen/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>GNU Screen window captions as XTerm tabs</title>
		<link>http://blog.bigsmoke.us/2008/12/04/gnu-screen-window-captions-as-xterm-tabs</link>
		<comments>http://blog.bigsmoke.us/2008/12/04/gnu-screen-window-captions-as-xterm-tabs#comments</comments>
		<pubDate>Thu, 04 Dec 2008 20:17:41 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[GNU]]></category>
		<category><![CDATA[Screen]]></category>
		<category><![CDATA[XTerm]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=202</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>XTerm is my <a href="http://blog.bigsmoke.us/2008/11/27/xterm-is-favorite">favorite terminal emulator</a> and I love GNU Screen. So, imagine my joy when I found out that Screen can persistently show window captions (<q><kbd>[Ctrl+A]: caption always</kbd></q>).</p>

<p><img src="http://blog.bigsmoke.us/wp-factory/../uploads/2008/12/screen-with-default-window-captions-in-xterm.png" alt="GNU Sreen with default window captions (in XTerm)" title="GNU Sreen with default window captions (in XTerm)" class="size-full wp-image-205" /></p>

<p>Now I wouldn&#8217;t loose track of my windows so easily. No more detours through the Window-list, and it gets better; from the Screen manual, I learned that I could set the caption to a string. Look what <q><kbd>[Ctrl+A]: caption '%w'</kbd></q> does:</p>

<p><img src="http://blog.bigsmoke.us/wp-factory/../uploads/2008/12/screen-with-simple-window-captions-in-xterm.png" alt="GNU Screen with simple window captions (in XTerm)" title="GNU Screen with simple window captions in XTerm" class="size-full wp-image-204" /></p>

<p>Cool! I could finally have my XTerm tabs. <img src='http://blog.bigsmoke.us/wp-factory/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Just recently, I was telling <a href="/author/halfgaar">Wiebe</a>&#8212;in reply to a complaint of him about getting lost in Screen&#8217;s window list&#8212;how cool it would be if you could have a terminal emulator display a tab for each screen window. Now I can tell him, instead, that tabs in a terminal emulator are a superfluous feature.</p>

<h2>My current configuration</h2>

<p><img src="http://blog.bigsmoke.us/uploads/2008/12/screen-with-window-captions-in-xterm.png" alt="GNU Screen with window captions (in XTerm)" title="GNU Screen with window captions (in XTerm)" class="size-full wp-image-203" /></p>

<p>This last example is done with the following Screen command: <q><kbd>caption always "%{= kB}%-Lw%{=s kB}%50>%n%f* %t %{-}%+Lw%<"</kbd></q> There are more examples in the manual page. Enjoy your tabs!</p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2008/12/04/gnu-screen-window-captions-as-xterm-tabs/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Remote pair programming with GNU Screen</title>
		<link>http://blog.bigsmoke.us/2008/07/23/pair-programming-through-gnu-screen</link>
		<comments>http://blog.bigsmoke.us/2008/07/23/pair-programming-through-gnu-screen#comments</comments>
		<pubDate>Wed, 23 Jul 2008 16:09:08 +0000</pubDate>
		<dc:creator>Rowan Rodrik</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Extreme Programming]]></category>
		<category><![CDATA[pair programming]]></category>
		<category><![CDATA[Screen]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[XTerm]]></category>

		<guid isPermaLink="false">http://blog.bigsmoke.us/?p=101</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p>I like pair programming. So much, in fact, that I want to do it even if I can&#8217;t look over the other person&#8217;s shoulder due to some geographical offset. Since I&#8217;m a real command-line freak, I can get what I want easily by using GNU Screen.</p>

<h2>GNU Screen rehash</h2>

<p>If you don&#8217;t know GNU screen yet and you ever find yourself using the command-line for an extended period of time, learn it. Now. I&#8217;ll name just a few advantages:</p>

<ol>
  <li>You can manage multiple &#8220;windows&#8221; conveniently even if you don&#8217;t have a tabbed terminal emulator, or even when you&#8217;re not within a graphic environment such as X.</li>
  <li>You can &#8220;detach&#8221; and &#8220;reattach&#8221; your Screen sessions and continue exactly where you left. This is very useful if you do your work on a remote server, through SSH, for example. Never by stumped by instable connections again!</li>
  <li>But, the feature which is most useful for pair programming is the ability to attach to the same session from multiple terminals.</li>
</ol>

<p>Starting GNU Screen is very easy. Just type <q><kbd>screen</kbd></q> at your shell prompt (or <q><kbd>screen -S SESSION_NAME</kbd></q> if you want your session to have an easy-to-remember name).</p>

<p>Press <kbd>CTRL+A</kbd> followed by <kbd>d</kbd> to detach. Exit your terminal. Start a new terminal, type <q><kbd>screen -r</kbd></q> and be amazed that you have your session back. <q><kbd>screen -r</kbd></q> can take as an argument the name or <abbr title="Process ID">PID</abbr> of the screen, which is useful if you have more than one screen running. To get a list of current screen sessions, type <q><kbd>screen -ls</kbd></q>.</p>

<h2>Inviting your observer</h2>

<p>The first thing you have to do is to add the following command to your <tt>.screenrc</tt> file:</p>

<pre>multiuser on</pre>

<p>If you don&#8217;t want to enable multiuser by default, you can also choose to type the command from within Screen each time that you need it. This is done by pressing <kbd>Ctrl+A</kbd>, followed by <kbd>:</kbd> and the command.</p>

<p>Myself, I prefer to have the command in my <tt>.screenrc</tt>. You need to admit users explicitly anyway. Admitting full access to a user is done by typing the <q><kbd>:acladd USERNAME</kbd></q> command (after pressing <kbd>Ctrl+A</kbd>). Then the given user can join this session by starting screen with <q><kbd>screen -x SESSION_OWNER/</kbd></q> where <tt>SESSION_OWNER</tt> is the driver.</p>

<h2>Get out of my driver&#8217;s seat! (Dealing with annoying observers)</h2>

<p>The <q><kbd>:acladd USERNAME</kbd></q> command will give the observer full read-write access. Maybe, if you have to deal with an observer who insists on taking the driver seat, you want to limit his or her access to read-only. This can be done just as easily: press <kbd>Ctrl+A</kbd>; then type <q><kbd>:aclchg USERNAME -w "#"</kbd></q>.

<h2>Make your terminals match</h2>

<p>Using a shared screen, it can be kind of annoying if your terminal sizes don&#8217;t match. As an observer, I fix this by asking the driver to tell me the values of the <tt>$ROWS</tt> and <tt>$COLS</tt> environment variables. If then, for example <tt>$COLS=110</tt> and <tt>$ROWS=40</tt>, I start my xterm with this in mind: <q><kbd>xterm -geometry 110x40</kbd></q></p>

<h2>Have fun with Screen!</h2>

<p>I&#8217;ve only touched upon some of the things you can do with screen. The manual page contains much more information&#8212;perhaps a bit too much even. <img src='http://blog.bigsmoke.us/wp-factory/wp-includes/images/smilies/icon_confused.gif' alt=':-?' class='wp-smiley' /> </p>

<p>One of the things I also like to do with a shared screen session is remote system administration. If I want to perform delicate tasks as root, I find it kind of comforting if someone can stop me in time, before I do anything stupid. Besides, if you&#8217;re both root, you don&#8217;t even have to set permissions. <img src='http://blog.bigsmoke.us/wp-factory/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  So, it&#8217;s easy to.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.bigsmoke.us/2008/07/23/pair-programming-through-gnu-screen/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

