<?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>My stuff &#187; Linux/Unix</title>
	<atom:link href="http://michelhollands.net/blog/index.php/category/linuxunix/feed/" rel="self" type="application/rss+xml" />
	<link>http://michelhollands.net/blog</link>
	<description>Tech and travel tidbits</description>
	<lastBuildDate>Tue, 13 Dec 2011 09:59:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>GNU chess and xboard on eee PC</title>
		<link>http://michelhollands.net/blog/2008/10/06/gnu-chess-and-xboard-on-eee-pc/</link>
		<comments>http://michelhollands.net/blog/2008/10/06/gnu-chess-and-xboard-on-eee-pc/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 08:31:15 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://michelhollands.net/blog/2008/10/06/gnu-chess-and-xboard-on-eee-pc/</guid>
		<description><![CDATA[The eee PC is a cool little machine. It boots up in 20 seconds, weights about a kilo and it runs Linux. What else do you want in a netbook ? A chess program would be a nice addition. Here I&#8217;ll show you how to install GNU chess and xboard. First download the following packages [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://eeepc.asus.com">eee PC</a> is a cool little machine. It boots up in 20 seconds, weights about a kilo and it runs Linux. What else do you want in a <a href="http://en.wikipedia.org/wiki/Netbook">netbook</a> ? </p>
<p>A chess program would be a nice addition. Here I&#8217;ll show you how to install GNU chess and xboard.</p>
<ol>
<li>First download the following packages :
<ul>
<li>the <a href="http://packages.debian.org/etch/gnuchess">debian etch gnuchess</a> package</li>
<li>the <a href="http://packages.debian.org/etch/xaw3dg">debian etch xaw3dg</a> package</li>
<li>the <a href="http://packages.debian.org/etch/xboard">debian etch xboard</a> package</li>
</ul>
<p>        You&#8217;ll need to download the i386 architecture package.
        </li>
<li>Next, open the file manager. Right click on the gnuchess package and select &#8216;Install DEB file&#8230;&#8217; . After a while a message will be shown saying it was successfully installed.
        </li>
<li>Do the same for the xaw3dg package</li>
<li>And the same for the xboard package</li>
<li>While still in the file manager, click ctrl+T (control t). This opens the console. In there type xboard</li>
<li>A chessboard should now appear :<br />
<center><br />
<a href='http://michelhollands.net/blog/wp-content/uploads/2008/10/xboard.png' title='xboard.png'><img src='http://michelhollands.net/blog/wp-content/uploads/2008/10/xboard.thumbnail.png' alt='xboard.png' /></a><br />
</center>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://michelhollands.net/blog/2008/10/06/gnu-chess-and-xboard-on-eee-pc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Korn shell way of checking if environment variable is set</title>
		<link>http://michelhollands.net/blog/2007/07/04/korn-shell-way-of-checking-if-environment-variable-is-set/</link>
		<comments>http://michelhollands.net/blog/2007/07/04/korn-shell-way-of-checking-if-environment-variable-is-set/#comments</comments>
		<pubDate>Wed, 04 Jul 2007 15:41:15 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://michelhollands.net/blog/2007/07/04/korn-shell-way-of-checking-if-environment-variable-is-set/</guid>
		<description><![CDATA[Sometimes you have to check if a variable is set and exit if it&#8217;s not. The following code does it in a nice and simple way : error_mess=&#34;This environment variable should be set&#34; &#160; : ${ORACLE_HOME:?$error_mess} The output looks like this : ./script.sh[3]: ORACLE_HOME: This environment variable should be set The script exits after checking [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you have to check if a variable is set and exit if it&#8217;s not. The following code does it in a nice and simple way :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #007800;">error_mess</span>=<span style="color: #ff0000;">&quot;This environment variable should be set&quot;</span>
&nbsp;
  : <span style="color: #800000;">${ORACLE_HOME:?$error_mess}</span></pre></div></div>

<p>The output looks like this :</p>
<pre>
  ./script.sh[3]: ORACLE_HOME: This environment variable should be set
</pre>
<p>The script exits after checking ORACLE_HOME, none of the following commands get executed.</p>
<p>I found this in the <a href="http://www.awprofessional.com/articles/article.asp?p=99035&#038;seqNum=3&#038;rl=1">sample chapter</a> of the <a href="http://www.awprofessional.com/title/0201675234">The Korn Shell: Unix &#038; Linux Programming Manual, 3rd Edition</a> book.</p>
]]></content:encoded>
			<wfw:commentRss>http://michelhollands.net/blog/2007/07/04/korn-shell-way-of-checking-if-environment-variable-is-set/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automating FTP</title>
		<link>http://michelhollands.net/blog/2007/07/02/automating-ftp/</link>
		<comments>http://michelhollands.net/blog/2007/07/02/automating-ftp/#comments</comments>
		<pubDate>Mon, 02 Jul 2007 10:58:37 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://michelhollands.net/blog/2007/07/02/automating-ftp/</guid>
		<description><![CDATA[Here&#8217;s how you automate FTP : ftp -v -n hostname &#60;&#60; EOF user usuario password bin put filename bye EOF With thanks to this post.]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s how you automate FTP :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #c20cb9; font-weight: bold;">ftp</span> <span style="color: #660033;">-v</span> <span style="color: #660033;">-n</span> <span style="color: #c20cb9; font-weight: bold;">hostname</span> <span style="color: #000000; font-weight: bold;">&lt;&lt;</span> EOF
  user usuario password
  bin
  put filename
  bye
  EOF</pre></div></div>

<p>With thanks to <a href="http://www.ftpplanet.com/ubb/Forum5/HTML/000191.html">this post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://michelhollands.net/blog/2007/07/02/automating-ftp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HP Unix info</title>
		<link>http://michelhollands.net/blog/2007/06/21/hp-unix-info/</link>
		<comments>http://michelhollands.net/blog/2007/06/21/hp-unix-info/#comments</comments>
		<pubDate>Thu, 21 Jun 2007 10:50:13 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://michelhollands.net/blog/2007/06/21/hp-unix-info/</guid>
		<description><![CDATA[This is useful on HP Unix machines. It just prints out a few pieces of data of the machine. echo &#34;HP Unix version : &#34; `uname -a` echo &#34;Model : &#34; `/usr/bin/model` echo &#34;Number of processors : &#34; `/usr/sbin/ioscan -kf &#124; grep processor &#124; wc -l` An example output would be be : HP Unix [...]]]></description>
			<content:encoded><![CDATA[<p>This is useful on HP Unix machines. It just prints out a few pieces of data of the machine.</p>

<div class="wp_syntax"><div class="code"><pre class="sh" style="font-family:monospace;">  echo &quot;HP Unix version      : &quot; `uname -a`
  echo &quot;Model                : &quot; `/usr/bin/model`
  echo &quot;Number of processors : &quot; `/usr/sbin/ioscan -kf | grep processor | wc -l`</pre></div></div>

<p>An example output would be be :</p>
<pre>
  HP Unix version      :  HP-UX machine B.11.23 U ia64 ident_nr unlimited-user license
  Model                :  ia64 hp server rx4640
  Number of processors :  4
</pre>
<p>Funnily there doesn&#8217;t seem to be a standard command to get the total amount of memory in the machine. HP says <a href="http://h20331.www2.hp.com/Hpsub/cache/288622-0-0-225-121.html">here</a> that</p>
<pre>  /etc/dmesg | grep -i phys</pre>
<p>should work, but I don&#8217;t have the privileges to read this on the machines I use.</p>
<p>According to this <a href="http://xaxxon.slackworks.com/rsapi/">site</a>, the following C code can get this :</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;">  <span style="color: #339933;">#include &lt;sys/param.h&gt;</span>
  <span style="color: #339933;">#include &lt;sys/pstat.h&gt;</span>
&nbsp;
  <span style="color: #993333;">struct</span> pst_static pst<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// data that can't change between boots</span>
&nbsp;
  pstat_getstatic <span style="color: #009900;">&#40;</span> <span style="color: #339933;">&amp;</span>Pst<span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span> <span style="color: #009900;">&#40;</span> pst <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span>size_t<span style="color: #009900;">&#41;</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066;">printf</span> <span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">&quot;System has %d KB of memory<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span>
            pst.<span style="color: #202020;">physical_memory</span> <span style="color: #339933;">*</span> pst.<span style="color: #202020;">page_size</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The machines I work with usually don&#8217;t have C installed (I know), so this hasn&#8217;t been tested.</p>
]]></content:encoded>
			<wfw:commentRss>http://michelhollands.net/blog/2007/06/21/hp-unix-info/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No dos2unix, no perl</title>
		<link>http://michelhollands.net/blog/2007/05/24/no-dos2unix-no-perl/</link>
		<comments>http://michelhollands.net/blog/2007/05/24/no-dos2unix-no-perl/#comments</comments>
		<pubDate>Thu, 24 May 2007 09:42:12 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://michelhollands.net/blog/2007/05/24/no-dos2unix-no-perl/</guid>
		<description><![CDATA[I was stuck on a machine with a lot of scripts that had the dreaded ^M at the end of each line. These were Windows files in a huge zip file, and it was a pain to use the FTP to move that zip file over again. Dos2unix wasn&#8217;t installed, nor was perl. One way [...]]]></description>
			<content:encoded><![CDATA[<p>I was stuck on a machine with a lot of scripts that had the dreaded ^M at the end of each line. These were Windows files in a huge zip file, and it was a pain to use the FTP to move that zip file over again. Dos2unix wasn&#8217;t installed, nor was perl. One way out of this is by creating the following script, called transform.sh :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">   <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #660033;">-d</span> \\r <span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #007800;">$1</span>.fixed
   <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #007800;">$1</span>.fixed <span style="color: #007800;">$1</span></pre></div></div>

<p>This run tr on the file, stripping out newline (\r), and saves this in a new file with the postfix .fixed. So install.sh becomes install.sh.fixed. The second line overwrites the original file with this new version.</p>
<p>Then it&#8217;s just a matter of calling this for all the files :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">   <span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-type</span> f <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*.sh&quot;</span> <span style="color: #660033;">-exec</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>transform.sh <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;</pre></div></div>

<p>This finds all the files of type f, which means a normal file. The file also has to have the extension .sh. Then our script transform.sh is called on that file, passing in the filename, specified by {}, as a parameter.</p>
<p>BTW : the way to do this in Perl is :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #c20cb9; font-weight: bold;">perl</span> –pi –e <span style="color: #ff0000;">'s/^M//'</span> <span style="color: #000000; font-weight: bold;">*</span></pre></div></div>

<p>The ^M is entered by pressing Ctrl-V followed by Ctrl-M .</p>
]]></content:encoded>
			<wfw:commentRss>http://michelhollands.net/blog/2007/05/24/no-dos2unix-no-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using while loops with read</title>
		<link>http://michelhollands.net/blog/2007/05/08/using-while-loops-with-read/</link>
		<comments>http://michelhollands.net/blog/2007/05/08/using-while-loops-with-read/#comments</comments>
		<pubDate>Tue, 08 May 2007 10:41:32 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://michelhollands.net/blog/2007/05/08/using-while-loops-with-read/</guid>
		<description><![CDATA[If you want to loop over values in a file, the read command in Linux/Unix is very useful. It reads a line from a file, and assigns as many variables as you specify as parameters to the values in that line. Combined with a while loop, you can read the values and process them. Here&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to loop over values in a file, the read command in Linux/Unix is very useful. It reads a line from a file, and assigns as many variables as you specify as parameters to the values in that line. Combined with a while loop, you can read the values and process them. Here&#8217;s an example :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> customernr
  <span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #000000; font-weight: bold;">&lt;</span>some_script<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$customernr</span>
  <span style="color: #000000; font-weight: bold;">done</span> <span style="color: #000000; font-weight: bold;">&lt;</span> customers.txt</pre></div></div>

<p>This loops over all the lines in the customers.txt file. This file contains one customer number per line. Then we can reference this customer number as $customernr, and process it. Here that value is given as a parameter to some script.</p>
<p>Thanks to <a href="http://steve-parker.org/sh/loops.shtml#while">Steve Parker&#8217;s website<a> for reminding me of the syntax of the while loop. It&#8217;s funny how Google has replaced reading man pages.</p>
]]></content:encoded>
			<wfw:commentRss>http://michelhollands.net/blog/2007/05/08/using-while-loops-with-read/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Showing special characters in filename</title>
		<link>http://michelhollands.net/blog/2007/05/03/showing-special-characters-in-filename/</link>
		<comments>http://michelhollands.net/blog/2007/05/03/showing-special-characters-in-filename/#comments</comments>
		<pubDate>Thu, 03 May 2007 09:56:57 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://michelhollands.net/blog/2007/05/03/showing-special-characters-in-filename/</guid>
		<description><![CDATA[Sometimes, especially if your terminal is not set correctly, you accidentally create files that have backspace in their name. To see the full name, you can use the -b option to ls : &#62; ls -b gjdhjd\177\177.txt This file has 2 backspace characters in the name, they are shown as \177. That will give you [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes, especially if your terminal is not set correctly, you accidentally create files that have backspace in their name. To see the full name, you can use the -b option to ls :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">   <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-b</span>
   gjdhjd\<span style="color: #000000;">177</span>\<span style="color: #000000;">177</span>.txt</pre></div></div>

<p>This file has 2 backspace characters in the name, they are shown as \177. That will give you the full name, which you can use to delete or rename the file.</p>
<p>If you want to delete these files, you can use the -i option to ls. This will print the inode number as first entry on the output. You can then use find to delete it :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">   <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-inum</span> <span style="color: #000000;">16749</span> <span style="color: #660033;">-exec</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \;</pre></div></div>

<p>16749 is the inode number.</p>
]]></content:encoded>
			<wfw:commentRss>http://michelhollands.net/blog/2007/05/03/showing-special-characters-in-filename/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing the default font for Eclipse</title>
		<link>http://michelhollands.net/blog/2003/07/05/changing-the-default-font-for-eclipse/</link>
		<comments>http://michelhollands.net/blog/2003/07/05/changing-the-default-font-for-eclipse/#comments</comments>
		<pubDate>Sat, 05 Jul 2003 10:39:05 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Linux/Unix]]></category>

		<guid isPermaLink="false">http://michelhollands.net/blog/2003/07/05/changing-the-default-font-for-eclipse/</guid>
		<description><![CDATA[Eclipse is a great development environment for Java on Linux, however there might be some issues with the fonts. The Preferences window only allows you to change certain fonts, with no way to change the menu font and the font in the outline or package explorer view. If your display has a high resolution, like [...]]]></description>
			<content:encoded><![CDATA[<p>Eclipse is a great development environment for Java on Linux, however there might be some issues with the fonts. The Preferences window only allows you to change certain fonts, with no way to change the menu font and the font in the outline or package explorer view.</p>
<p>If your display has a high resolution, like 1400 by 1050, these fonts will look too large, making the program a bit less useable.</p>
<p>The fonts in question are taken from the system default font. In order to change this, you have to make sure that the .gtkrc-2.0 file exists in your home directory. Just adding the following will change that font :</p>
<pre>
   # configure the GTK+ default font for non-gnome apps
   gtk-font-name = "verdana 8"
</pre>
<p>Note that this is the change needed for the GTK version of Eclipse. For the Motif version you probable have to change your .Xdefaults file. More information about this can be found on the eclipse website at <a href="http://www.eclipse.org">www.eclipse.org</a>, notably in the newsgroups.</p>
]]></content:encoded>
			<wfw:commentRss>http://michelhollands.net/blog/2003/07/05/changing-the-default-font-for-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.051 seconds -->

