<?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>david winter &#187; unix</title>
	<atom:link href="http://davidwinter.me.uk/articles/tag/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://davidwinter.me.uk</link>
	<description>you were expecting someone else?</description>
	<lastBuildDate>Mon, 28 Jun 2010 20:37:42 +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>Avoid giving 777 permissions</title>
		<link>http://davidwinter.me.uk/articles/2010/06/28/avoid-giving-777-permissions/</link>
		<comments>http://davidwinter.me.uk/articles/2010/06/28/avoid-giving-777-permissions/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 20:37:42 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/?p=211</guid>
		<description><![CDATA[Just a quick post for me to remember the following workflow of commands: sudo find . -type d -exec chmod 755 {} \; sudo find . -type f -exec chmod 644 {} \; sudo chgrp -R www-data . sudo chmod -R g+w .]]></description>
			<content:encoded><![CDATA[<p>Just a quick post for me to remember the following workflow of commands:</p>

<pre><code>sudo find . -type d -exec chmod 755 {} \;
sudo find . -type f -exec chmod 644 {} \;
sudo chgrp -R www-data .
sudo chmod -R g+w .
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2010/06/28/avoid-giving-777-permissions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove startup scripts on Ubuntu</title>
		<link>http://davidwinter.me.uk/articles/2009/10/20/remove-startup-scripts-on-ubuntu/</link>
		<comments>http://davidwinter.me.uk/articles/2009/10/20/remove-startup-scripts-on-ubuntu/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 19:55:40 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/articles/2009/10/20/remove-startup-scripts-on-ubuntu/</guid>
		<description><![CDATA[sudo update-rc.d -f script_name remove]]></description>
			<content:encoded><![CDATA[<pre><code>sudo update-rc.d -f script_name remove
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2009/10/20/remove-startup-scripts-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Merge video files with mencoder</title>
		<link>http://davidwinter.me.uk/articles/2008/05/17/merge-video-files-with-mencoder/</link>
		<comments>http://davidwinter.me.uk/articles/2008/05/17/merge-video-files-with-mencoder/#comments</comments>
		<pubDate>Sat, 17 May 2008 19:48:04 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[mencoder]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/?p=95</guid>
		<description><![CDATA[To merge video files together with mencoder is simple: mencoder -oac copy -ovc copy file1.avi file2.avi file3.avi -o full_movie.avi]]></description>
			<content:encoded><![CDATA[<p>To merge video files together with <code>mencoder</code> is simple:</p>

<pre><code>mencoder -oac copy -ovc copy file1.avi file2.avi file3.avi -o full_movie.avi
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2008/05/17/merge-video-files-with-mencoder/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Graphviz&#8211;for drawing directed graphs</title>
		<link>http://davidwinter.me.uk/articles/2007/03/14/graphviz-for-drawing-directed-graphs/</link>
		<comments>http://davidwinter.me.uk/articles/2007/03/14/graphviz-for-drawing-directed-graphs/#comments</comments>
		<pubDate>Wed, 14 Mar 2007 20:11:56 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[apps]]></category>
		<category><![CDATA[drawing]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[uni]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/articles/2007/03/14/graphviz-for-drawing-directed-graphs/</guid>
		<description><![CDATA[This semester at University, I&#8217;m taking &#8216;Compiler Design &#38; Techniques&#8217; as a module. The second coursework involves drawing Finite State Machines diagrams that represent regular expressions. Rather than using a word processor to draw these diagrams with a rather untidy look about them, I went in search of a tool that&#8217;d help me produce high [...]]]></description>
			<content:encoded><![CDATA[<p>This semester at University, I&#8217;m taking &#8216;Compiler Design &amp; Techniques&#8217; as a module. The second coursework involves drawing <a href="http://en.wikipedia.org/wiki/Finite_state_machines">Finite State Machines</a> diagrams that represent regular expressions. Rather than using a word processor to draw these diagrams with a rather untidy look about them, I went in search of a tool that&#8217;d help me produce high quality drawings. I&#8217;d heard that Latex was good for mathematical diagrams, but that seemed like overkill as I only wanted the diagrams, not a whole new document syntax to learn.</p>

<p><span id="more-61"></span></p>

<p>I come across <a href="http://www.graphviz.org/">Graphviz</a>. Open source and available on near enough all platforms&#8211;<a href="http://www.ryandesign.com/graphviz/">Mac</a>, <a href="http://www.graphviz.org/Download_linux.php">Linux</a> and <a href="http://www.graphviz.org/Download_windows.php">Windows</a>. Using a very simple syntax, you create <code>dot</code> files and then using the <code>dot</code> tool, you can generate PNG images of your diagrams.</p>

<p>Here is an example <code>dot</code> script:</p>

<pre><code>digraph my_fsm {
    label = "ab*(cd)+|b";
    rankdir = LR;
    node [shape = doublecircle]; 3 4;
    node [shape = circle];
    0 -&gt; 1 [label = "a"];
    1 -&gt; 1 [label = "b"];
    1 -&gt; 2 [label = "c"];
    2 -&gt; 3 [label = "d"];
    3 -&gt; 2 [label = "c"];
    0 -&gt; 4 [label = "b"];
}
</code></pre>

<p>Following is an explanation of the above script:</p>

<ol>
<li>I&#8217;m declaring the graph as a directed graph with <code>digraph</code>.</li>
<li><code>my_fsm</code> is just the name I&#8217;ve given the graph. This can be anything.</li>
<li>I add a label to the graph which holds the regular expression that I&#8217;m drawing. This isn&#8217;t required, but just helps by giving it a title.</li>
<li><code>rankdir</code> specifies the direction of the diagram. I&#8217;m specifying &#8216;left to right&#8217; with <code>LR</code>.</li>
<li>So that I can differentiate between accepting states and normal states, I&#8217;m declaring that nodes 3 and 4 will have a double circle around them.</li>
<li>For all other nodes, I just want to use the normal <code>circle</code> shape.</li>
<li>Lastly, I declare the nodes and their edges. Also, I add a label to each edge.</li>
</ol>

<p>Once you save the file, you can run it through the <code>dot</code> program using the following command:</p>

<pre><code>dot my_file.dot -Tpng -o my_fsm.png
</code></pre>

<p>You&#8217;ll need to check where <code>dot</code> was installed. With the Mac installer package it is installed to <code>/usr/local/graphviz-2.12/bin/dot</code>, so you&#8217;ll need to modify the above command to reflect the correct location.</p>

<p>The outputted file, <code>my_fsm.png</code> in this example, should result in something that looks like the one below.</p>

<p><img src="http://davidwinter.me.uk/wp-content/uploads/2007/03/my_fsm.png" alt="Finite State Machine Example" /></p>

<p>A very handy tool indeed. There is a <a href="http://www.graphviz.org/Documentation/dotguide.pdf">PDF guide</a> on all the commands available. Of which, I&#8217;m next going to look for how to space the graph out a bit more as it&#8217;s a little squashed at the moment.</p>

<p>Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2007/03/14/graphviz-for-drawing-directed-graphs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Unix Disk Usage</title>
		<link>http://davidwinter.me.uk/articles/2007/01/21/unix-disk-usage/</link>
		<comments>http://davidwinter.me.uk/articles/2007/01/21/unix-disk-usage/#comments</comments>
		<pubDate>Sun, 21 Jan 2007 12:28:36 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[command line]]></category>
		<category><![CDATA[dapper]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/articles/2007/01/21/unix-disk-usage/</guid>
		<description><![CDATA[A very handy command to see the total size of a directory on a Unix-based computer. du -sh * This will show the total size of files and directories in your current working directory. The s flag means to show a summary&#8211;which basically just shows the top level directory only, instead of the contents of [...]]]></description>
			<content:encoded><![CDATA[<p>A very handy command to see the total size of a directory on a Unix-based computer.</p>

<pre><code>du -sh *
</code></pre>

<p>This will show the total size of files and directories in your current working directory. The <code>s</code> flag means to show a summary&#8211;which basically just shows the top level directory only, instead of the contents of each and every folder down the file system hierarchy. The <code>h</code> flag shows a human readable file size.</p>

<p>For my home directory, I get the following output:</p>

<pre><code>404M    Desktop
 30G    Documents
6.0G    Library
 32G    Movies
 18G    Music
 11G    Pictures
2.7G    Projects
 16K    Public
166M    Sites
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2007/01/21/unix-disk-usage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change your Terminal prompt &#8211; Lost style</title>
		<link>http://davidwinter.me.uk/articles/2006/12/06/change-your-terminal-prompt-lost-style/</link>
		<comments>http://davidwinter.me.uk/articles/2006/12/06/change-your-terminal-prompt-lost-style/#comments</comments>
		<pubDate>Wed, 06 Dec 2006 15:09:50 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[command line]]></category>
		<category><![CDATA[lost]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://davidwinter.me.uk/articles/2006/12/06/change-your-terminal-prompt-lost-style/</guid>
		<description><![CDATA[Fancy a change from the default prompt you get in your Terminal? Want to mimic the Terminal prompt used in Lost? I did, and during a boring lecture at Uni, decided to update it. I&#8217;m using zsh currently, but this will also work for a bash shell (default with Mac OS X). I&#8217;m using TextMate [...]]]></description>
			<content:encoded><![CDATA[<p>Fancy a change from the default prompt you get in your Terminal? Want to mimic the Terminal prompt used in <a href="http://abc.go.com/primetime/lost/index">Lost</a>? I did, and during a boring lecture at Uni, decided to update it.</p>

<p><img src="http://davidwinter.me.uk/wp-content/uploads/2006/12/lost-prompt.png" alt="Lost Terminal Prompt" /></p>

<p><span id="more-43"></span></p>

<p>I&#8217;m using <code>zsh</code> currently, but this will also work for a <code>bash</code> shell (default with Mac OS X). I&#8217;m using <a href="http://macromates.com/">TextMate</a> to edit my files, but if you&#8217;re on Linux (<a href="http://www.ubuntu.com">Ubuntu</a>, right?), then just substitute the <code>mate</code> command for <code>nano</code> or your favourite editor.</p>

<p>Just to make sure that you&#8217;re in your home directory:</p>

<pre><code>cd ~
</code></pre>

<p>Now open your shell profile. If you&#8217;re using <code>zsh</code>:</p>

<pre><code>mate .zprofile
</code></pre>

<p>Or if you&#8217;re using <code>bash</code>:</p>

<pre><code>mate .bashrc
</code></pre>

<p>Now add the following line:</p>

<pre><code>export PS1="&gt;: "
</code></pre>

<p>Save and close the file.</p>

<p>Now, make sure you have the right colour scheme going on.</p>

<ol>
<li>&#8216;Terminal&#8217; from the main menu.</li>
<li>Select &#8216;Window Settings&#8217;</li>
<li>Select &#8216;Color&#8217; in the drop down</li>
<li>Select &#8216;Green on Black&#8217; from the &#8216;Standard Color Selections&#8217;</li>
<li>Click the big &#8216;Use Settings as Defaults&#8217;</li>
<li>Close the window, and you&#8217;re done</li>
</ol>

<p>Open a new Terminal window and you should get a nice Lost &#8216;style&#8217; for your prompt. Nothing too fancy&#8211;just something nice and simple. </p>

<p><img src="http://davidwinter.me.uk/wp-content/uploads/2006/12/mac-lost-prompt.png" alt="Lost style Mac prompt" /></p>

<p>Now, you only have 108 minutes to enter the code&#8230; so don&#8217;t waste time!</p>

<p>Damn. I can&#8217;t wait until the next episode.</p>
]]></content:encoded>
			<wfw:commentRss>http://davidwinter.me.uk/articles/2006/12/06/change-your-terminal-prompt-lost-style/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
