<?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>JW Network Consulting &#187; FreeBSD</title>
	<atom:link href="http://www.jwnetworkconsulting.com/tag/freebsd/feed" rel="self" type="application/rss+xml" />
	<link>http://www.jwnetworkconsulting.com</link>
	<description>Watching the network so you don't have to.</description>
	<lastBuildDate>Sun, 30 Oct 2011 22:06:07 +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>Using &#8216;script&#8217; to record your session</title>
		<link>http://www.jwnetworkconsulting.com/freebsd/using-script-to-record-your-session</link>
		<comments>http://www.jwnetworkconsulting.com/freebsd/using-script-to-record-your-session#comments</comments>
		<pubDate>Sun, 01 Feb 2009 19:47:27 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.jwnetworkconsulting.com/?p=151</guid>
		<description><![CDATA[This is something that I ran across recently and that I probably should have known about before.  I was doing some testing for an upcoming upgrade and was getting annoyed because I didn&#8217;t have a good way to go review the results.  I knew there had to be something out there for this though, so [...]]]></description>
			<content:encoded><![CDATA[<p>This is something that I ran across recently and that I probably should have known about before.  I was doing some testing for an upcoming upgrade and was getting annoyed because I didn&#8217;t have a good way to go review the results.  I knew there had to be something out there for this though, so I did some digging.</p>
<p>Turns out that UNIX/Linux has a command named &#8216;script&#8217; which takes care of this for you.  I did a quick check and found that it&#8217;s part of the install on FreeBSD, Mac OS X and Ubuntu Linux.  It&#8217;s probably on nearly any *nix, but those are just the ones that I checked.  Running it is real hard.</p>
<pre class="qoate-code">
(jwood@Yardley.local)~
(0 12:33:54 504) -&gt; script foo.txt
Script started, output file is foo.txt
(jwood@Yardley.local)~
(0 12:33:58 501) -&gt; exit

Script done, output file is foo.txt
(jwood@Yardley.local)~
(0 12:34:01 505) -&gt;
</pre>
<p>The output is all logged into the file foo.txt.  So that&#8217;s neat and all, but what if I sudo to root?</p>
<pre class="qoate-code">
(jwood@Yardley.local)~
(0 12:35:49 511) -&gt; script foo.txt
Script started, output file is foo.txt
(jwood@Yardley.local)~
(0 12:35:52 501) -&gt; sudo -H -s
Password:
bash-3.2# cd temp/
bash-3.2# ls
.bash_profile           py-eve-test.py          zork
.bashrc                 rubygems-1.1.0          zorki.hqx
nagios-3.0.6            rubygems-1.1.0.tgz
bash-3.2# cd ..
bash-3.2# exit
(jwood@Yardley.local)~
(0 12:36:09 502) -&gt; exit

Script done, output file is foo.txt
(jwood@Yardley.local)~
(0 12:36:12 512) -&gt;
</pre>
<p>Now, I to see what was recorded, I cat foo.txt.</p>
<pre class="qoate-code">
(jwood@Yardley.local)~
(0 12:36:57 513) -&gt; cat foo.txt
Script started on Sun Feb  1 12:35:52 2009
(jwood@Yardley.local)~
(0 12:35:52 501) -&gt; sudo -H -s
Password:
bash-3.2# cd temp/
bash-3.2# ls
.bash_profile           py-eve-test.py          zork
.bashrc                 rubygems-1.1.0          zorki.hqx
nagios-3.0.6            rubygems-1.1.0.tgz
bash-3.2# cd ..
bash-3.2# exit
(jwood@Yardley.local)~
(0 12:36:09 502) -&gt; exit

Script done on Sun Feb  1 12:36:12 2009
(jwood@Yardley.local)~
(0 12:37:00 514) -&gt;
</pre>
<p>Perfect!  It recorded everything I did.  Or is it perfect?  In my case, not exactly.  You may notice that I have a fancy command prompt.  It&#8217;s got pretty colors and everything.  It seems that complicates things a bit.  When I open the file with vi, the problem becomes more apparent.</p>
<pre class="qoate-code">
(0 12:36:57 513) -&gt; cat foo.txt
Script started on Sun Feb  1 12:35:52 2009
^[[0;31m(^[[1;32mjwood^[[1;37m@^[[1;32mYardley.local^[[0;31m)^[[1;34m~
^[[0;31m(^[[0;31m0 ^[[0;36m12:35:52 ^[[0;32m501^[[0;31m) ^[[1;34m-&gt;^[[0m sudo -H -s
Password:
bash-3.2# cd temp/
bash-3.2# ls
.bash_profile           py-eve-test.py          zork
.bashrc                 rubygems-1.1.0          zorki.hqx
nagios-3.0.6            rubygems-1.1.0.tgz
bash-3.2# cd ..
bash-3.2# exit
^[[0;31m(^[[1;32mjwood^[[1;37m@^[[1;32mYardley.local^[[0;31m)^[[1;34m~
^[[0;31m(^[[0;31m0 ^[[0;36m12:36:09 ^[[0;32m502^[[0;31m) ^[[1;34m-&gt;^[[0m exit

Script done on Sun Feb  1 12:36:12 2009
</pre>
<p>Notice that after I sudo to root, the command prompt is simplified and the text file suddenly becomes more legible.  All the stuff that I have going on in my bashrc file makes reading the text file a bit more complicated.  Obviously simplifying my command prompt will make this go away.  </p>
<p>Any how, its a pretty cool way to document what you are doing and what happened when while you were doing it.  Definitely something I will be using a lot more when I'm writing documentation<br />
<!-- start wp-tags-to-technorati 1.02 --></p>
<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/documentation' rel='tag' target='_self'>documentation</a>, <a class='technorati-link' href='http://technorati.com/tag/FreeBSD' rel='tag' target='_self'>FreeBSD</a>, <a class='technorati-link' href='http://technorati.com/tag/script' rel='tag' target='_self'>script</a>, <a class='technorati-link' href='http://technorati.com/tag/unix' rel='tag' target='_self'>unix</a></p>
<p><!-- end wp-tags-to-technorati --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jwnetworkconsulting.com/freebsd/using-script-to-record-your-session/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

