<?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>Schadenfreude &#187; screen</title>
	<atom:link href="http://www.ralree.com/tag/screen/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ralree.com</link>
	<description>Malicious enjoyment derived from observing someone else's misfortune</description>
	<lastBuildDate>Thu, 09 Feb 2012 01:49:15 +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>GNU Screen&#8217;s hardstatus</title>
		<link>http://www.ralree.com/2007/07/15/gnu-screen-s-hardstatus/</link>
		<comments>http://www.ralree.com/2007/07/15/gnu-screen-s-hardstatus/#comments</comments>
		<pubDate>Sun, 15 Jul 2007 00:17:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/gnu-screen-s-hardstatus</guid>
		<description><![CDATA[I use GNU Screen. A lot. I found an article linked from DIgg today that showed me how to use a setting called hardstatus to set the little bar at the bottom to my liking. I decided to mess around with it a bit, and I ended up with this: It shows my hostname, IP, uptime, screen window number and name, date and time, and load averages. Pretty cool, huh? This is how you do it: First, create a .screenrc [...]]]></description>
			<content:encoded><![CDATA[<p>I use GNU Screen.  A lot.  I found an article linked from <a href="http://www.digg.com">DIgg</a> today that showed me how to use a setting called <strong>hardstatus</strong> to set the little bar at the bottom to my liking.  I decided to mess around with it a bit, and I ended up with this:</p>
<p><img src="http://ralree.info/assets/2007/7/15/hardstatus.png" alt="Such a hard status!"/></p>
<p>It shows my hostname, IP, uptime, screen window number and name, date and time, and load averages.  Pretty cool, huh?</p>
<p>This is how you do it:</p>
<ul>
<li>First, create a <code>.screenrc</code> file and dump this in there:</li>
</ul>
<pre><code>
hardstatus alwayslastline
backtick 1 60 60 /home/hank/.screen_hardstatus
hardstatus string "%{Gk}%H: %{+s y}%1` | %=%n: %t%= | %m/%d %c | %{+b}%l"
</code></pre>
<ul>
<li>Now, see the line that starts with <strong>backtick</strong>?  That tells screen what program to run for assigning output to <code>%1`</code> in the hardstatus string.  Let&#8217;s make the <code>.screen_hardstatus</code> file as well (make it in your own home directory).</li>
</ul>
<pre><code>
#!/bin/bash
# Script to get run by hardstatus in screen.
# Prints customized single-line system stats
IP=`ifconfig eth0 | grep Mask | cut -d: -f2 | cut -d " " -f1`
UPTIME=`perl -pe 's/^(\d+).*/sprintf("%d", ($1\/(24*3600)))." days"/e' /proc/uptime`
echo -n "$IP | Up: $UPTIME"
</code></pre>
<p>I cheated and used perl, but all of this could safely be converted to <code>sed</code>/<code>awk</code> easily.  All this does is print my raw dotted quad IP address, a pipe, and then the current uptime in days rounded down.</p>
<ul>
<li>Now, just run <code>screen</code>.  You should see something similar to the first picture.  I used <a href="http://aperiodic.net/screen/string_escapes">this page</a> a lot to customize the colors, etc.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2007/07/15/gnu-screen-s-hardstatus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

