<?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; documentation</title>
	<atom:link href="http://www.jwnetworkconsulting.com/tag/documentation/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>Thu, 22 Jul 2010 01:23:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</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>
<div class="code panel" style="border-width: 1px;">
<div class="codeContent panelContent">
(jwood@Yardley.local)~<br />
(0 12:33:54 504) -> script foo.txt<br />
Script started, output file is foo.txt<br />
(jwood@Yardley.local)~<br />
(0 12:33:58 501) -> exit</p>
<p>Script done, output file is foo.txt<br />
(jwood@Yardley.local)~<br />
(0 12:34:01 505) ->
</p></div>
</div>
<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>
<div class="code panel" style="border-width: 1px;">
<div class="codeContent panelContent">
(jwood@Yardley.local)~<br />
(0 12:35:49 511) -> script foo.txt<br />
Script started, output file is foo.txt<br />
(jwood@Yardley.local)~<br />
(0 12:35:52 501) -> sudo -H -s<br />
Password:<br />
bash-3.2# cd temp/<br />
bash-3.2# ls<br />
.bash_profile           py-eve-test.py          zork<br />
.bashrc                 rubygems-1.1.0          zorki.hqx<br />
nagios-3.0.6            rubygems-1.1.0.tgz<br />
bash-3.2# cd ..<br />
bash-3.2# exit<br />
(jwood@Yardley.local)~<br />
(0 12:36:09 502) -> exit</p>
<p>Script done, output file is foo.txt<br />
(jwood@Yardley.local)~<br />
(0 12:36:12 512) ->
</p></div>
</div>
<p>Now, I to see what was recorded, I cat foo.txt.</p>
<div class="code panel" style="border-width: 1px;">
<div class="codeContent panelContent">
(jwood@Yardley.local)~<br />
(0 12:36:57 513) -> cat foo.txt<br />
Script started on Sun Feb  1 12:35:52 2009<br />
(jwood@Yardley.local)~<br />
(0 12:35:52 501) -> sudo -H -s<br />
Password:<br />
bash-3.2# cd temp/<br />
bash-3.2# ls<br />
.bash_profile           py-eve-test.py          zork<br />
.bashrc                 rubygems-1.1.0          zorki.hqx<br />
nagios-3.0.6            rubygems-1.1.0.tgz<br />
bash-3.2# cd ..<br />
bash-3.2# exit<br />
(jwood@Yardley.local)~<br />
(0 12:36:09 502) -> exit</p>
<p>Script done on Sun Feb  1 12:36:12 2009<br />
(jwood@Yardley.local)~<br />
(0 12:37:00 514) ->
</p></div>
</div>
<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>
<div class="code panel" style="border-width: 1px;">
<div class="codeContent panelContent">
(0 12:36:57 513) -> cat foo.txt<br />
Script started on Sun Feb  1 12:35:52 2009<br />
^[[0;31m(^[[1;32mjwood^[[1;37m@^[[1;32mYardley.local^[[0;31m)^[[1;34m~<br />
^[[0;31m(^[[0;31m0 ^[[0;36m12:35:52 ^[[0;32m501^[[0;31m) ^[[1;34m->^[[0m sudo -H -s<br />
Password:<br />
bash-3.2# cd temp/<br />
bash-3.2# ls<br />
.bash_profile           py-eve-test.py          zork<br />
.bashrc                 rubygems-1.1.0          zorki.hqx<br />
nagios-3.0.6            rubygems-1.1.0.tgz<br />
bash-3.2# cd ..<br />
bash-3.2# exit<br />
^[[0;31m(^[[1;32mjwood^[[1;37m@^[[1;32mYardley.local^[[0;31m)^[[1;34m~<br />
^[[0;31m(^[[0;31m0 ^[[0;36m12:36:09 ^[[0;32m502^[[0;31m) ^[[1;34m->^[[0m exit</p>
<p>Script done on Sun Feb  1 12:36:12 2009
</p></div>
</div>
<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&#8217;m writing documentation</p>

<!-- start wp-tags-to-technorati 1.01 -->

<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>

<!-- end wp-tags-to-technorati -->
]]></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>
