<?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/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:rawvoice="http://www.rawvoice.com/rawvoiceRssModule/"
>

<channel>
	<title>ITauthor &#187; UNIX/Linux</title>
	<atom:link href="http://www.itauthor.com/category/unixlinux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.itauthor.com</link>
	<description>Stuff about technical writing and software</description>
	<lastBuildDate>Sat, 07 Jan 2012 12:34:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<!-- podcast_generator="Blubrry PowerPress/2.0.4" -->
	<itunes:summary>Talking about technical writing, software and technology in general. The ITauthor Podcast is an advert-free, irregularly published show by technical writers for technical writers or anyone interested in software documentation or IT generally.</itunes:summary>
	<itunes:author>Alistair Christie - ITauthor.com</itunes:author>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://www.itauthor.com/images/ITauthor-PhotoLogo-300px.jpg" />
	<itunes:owner>
		<itunes:name>Alistair Christie - ITauthor.com</itunes:name>
		<itunes:email>comments@itauthor.com</itunes:email>
	</itunes:owner>
	<managingEditor>comments@itauthor.com (Alistair Christie - ITauthor.com)</managingEditor>
	<copyright>2006-2009</copyright>
	<itunes:subtitle>Talking about technical writing, software and technology in general.</itunes:subtitle>
	<itunes:keywords>itauthor, alistair christie, technology, writing, documentation</itunes:keywords>
	<image>
		<title>ITauthor &#187; UNIX/Linux</title>
		<url>http://www.itauthor.com/images/ITauthor-PhotoLogo-144px.jpg</url>
		<link>http://www.itauthor.com/category/unixlinux/</link>
	</image>
	<itunes:category text="Technology">
		<itunes:category text="Software How-To" />
		<itunes:category text="Tech News" />
		<itunes:category text="Podcasting" />
	</itunes:category>
		<item>
		<title>Control-Ms and zipping in UNIX</title>
		<link>http://www.itauthor.com/2009/08/14/control-ms-and-zipping-in-unix/</link>
		<comments>http://www.itauthor.com/2009/08/14/control-ms-and-zipping-in-unix/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 17:21:05 +0000</pubDate>
		<dc:creator>ac</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/2009/08/14/control-ms-and-zipping-in-unix/</guid>
		<description><![CDATA[This is one of those “So’s I Remember For Next Time” posts. A couple of obscure UNIX how-tos. Tip 1 – Entering Control-Ms in vi When you’re editing a text file in vi and the file was created in a Windows editor, you’ll see control-M (^M) characters at the end of each line. If you [...]]]></description>
			<content:encoded><![CDATA[<p>This is one of those “So’s I Remember For Next Time” posts. A couple of obscure UNIX how-tos.</p>
<h3>Tip 1 – Entering Control-Ms in vi</h3>
<p>When you’re editing a text file in vi and the file was created in a Windows editor, you’ll see control-M (^M) characters at the end of each line.<img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="control-Ms" border="0" alt="control-Ms" src="http://www.itauthor.com/wp-content/uploads/2009/08/controlMs.png" width="704" height="289" />     <br />If you want to add a new line and you want it to show up as a separate line in Windows, you’re going to have to add a control-M at the end of the line. The ^M is a single character, so you can’t just type <strong>^</strong> and then type <strong>M</strong>. You might think, given the name of the character, you could just hold down the <strong>Ctrl</strong> key and press <strong>m</strong>, but it’s not quite that simple. </p>
<p>What you need to do, in vi, is press <strong>Ctrl+v</strong> followed by <strong>Ctrl+m</strong>.</p>
<h3>Tip 2 – Zipping files in UNIX</h3>
<p>Usually when I’m working in UNIX and I want to compress a file, I use gzip:</p>
<p><strong>gzip <em>filename</em></strong></p>
<p>This replaces the named file with a compressed version of it, with <strong>.gz</strong> added onto the end of the file name. To unzip the file do:</p>
<p><strong>gunzip <em>filename</em></strong></p>
<p>This replaces the <strong>.gz</strong> file with the original file.</p>
<p>However, sometimes you need to create a <strong>.zip</strong> file. To do this use the <strong>zip</strong> command, but you need to know the syntax:</p>
<p><strong>zip –r <em>outputfile inputfile</em></strong></p>
<p>For example:</p>
<p><strong>zip –r temp.zip temp.txt</strong></p>
<p>In fact you don’t need to specify the <strong>.zip</strong> file extension. If you give a file name without a file name extension, the <strong>.zip</strong> extension gets added automatically.</p>
<p>A new zip file is created and the original file is not deleted. To unzip just do:</p>
<p><strong>unzip <em>zipfile</em></strong></p>
<p>This creates a new, unzipped file but does not delete the zip file.</p>
<p>I just tried this out and the following stats for compressing a small text file suggest that gzip is the more effective compression program:</p>
<p><strong>temp.txt&#160;&#160;&#160; </strong>677K    <br /><strong>temp.txt.gz</strong>&#160;&#160;&#160; 416K    <br /><strong>temp.zip</strong>&#160;&#160;&#160; 504K</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2009/08/14/control-ms-and-zipping-in-unix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing your CVS host</title>
		<link>http://www.itauthor.com/2009/02/05/changing-your-cvs-host/</link>
		<comments>http://www.itauthor.com/2009/02/05/changing-your-cvs-host/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 12:29:48 +0000</pubDate>
		<dc:creator>ac</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.eu/2009/02/05/changing-your-cvs-host/</guid>
		<description><![CDATA[What do you do if the host name of your CVS server changes? For example, here’s my case. I checked out a whole lot of CVS modules from the repository while my laptop was on the domain. Now however, thanks to Vista SP1 not playing with an antiquated NT domain, the laptop can’t join the [...]]]></description>
			<content:encoded><![CDATA[<p>What do you do if the host name of your CVS server changes? For example, here’s my case. I checked out a whole lot of CVS modules from the repository while my laptop was on the domain. Now however, thanks to Vista SP1 not playing with an antiquated NT domain, the laptop can’t join the domain so to connect to a server I need to qualify its name with a domain. So, whereas I checked out the modules using the hostname “cvshost”, I now need to use “cvshost.mydomain.co.uk”.</p>
<p>Unfortunately, TortoiseCVS has no way to change the host names for modules you’ve already checked out. WinCVS can, supposedly, do this thanks to a macro. However, WinCVS stubbornly tells me I don’t have Python installed (I do) and therefore won’t let me use macros.</p>
<p>The solution is to just go through all the CVS “Root” files and change the host name. The Root file lives in the CVS directory at each level within a checked out module. This would be a laborious task by hand, but if you have SUA (Microsoft’s Subsystem for UNIX Applications) and Perl installed it’s easy. Just pull up a Korn shell and browse to the directory within which your checked out CVS modules live.</p>
<p>Run the following command.</p>
<p><strong>find . -name 'Root' -print0 | xargs -0 perl -pi -e 's/oldhostname/newhostname/g'</strong></p>
<p>For example, I ran the command:</p>
<p><strong>find . -name 'Root' -print0 | xargs -0 perl -pi -e 's/cvshost/cvshost.mydomain.co.uk/g'</strong></p>
<p>Which changed the Contents of the Root file from:</p>
<p><font face="Courier">:pserver:achristie@cvshost:/company/repository</font></p>
<p>to:</p>
<p><font face="Courier">:pserver:achristie@cvshost.mydomain.co.uk:/company/repository</font></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2009/02/05/changing-your-cvs-host/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding ^M characters in vi</title>
		<link>http://www.itauthor.com/2008/11/25/adding-m-characters-in-vi/</link>
		<comments>http://www.itauthor.com/2008/11/25/adding-m-characters-in-vi/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 17:48:44 +0000</pubDate>
		<dc:creator>ac</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">/2008/11/25/adding-m-characters-in-vi/</guid>
		<description><![CDATA[This is an obscure one. There are lots of Web pages out there to tell you how to get rid of ^M characters in text files (dos2unix is your friend) but occasionally you need to edit a settings file on UNIX server where the file is normally edited using a Windows client. If you don't [...]]]></description>
			<content:encoded><![CDATA[<p>This is an obscure one. There are lots of Web pages out there to tell you how to get rid of ^M characters in text files (<strong>dos2unix</strong> is your friend) but occasionally you need to edit a settings file on UNIX server where the file is normally edited using a Windows client. If you don't add the ^M character at the end of each line, the lines will run together next time the file is viewed in Windows.</p>
<p>To add a ^M in vi enter <strong>Ctrl+V</strong> followed by <strong>Ctrl+M</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2008/11/25/adding-m-characters-in-vi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deleting a symbolic link via FTP</title>
		<link>http://www.itauthor.com/2008/10/14/deleting-a-symbolic-link-via-ftp/</link>
		<comments>http://www.itauthor.com/2008/10/14/deleting-a-symbolic-link-via-ftp/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 19:40:24 +0000</pubDate>
		<dc:creator>ac</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.itauthor.eu/2008/10/14/deleting-a-symbolic-link-via-ftp/</guid>
		<description><![CDATA[I just struggled for a while to delete a symbolic link on my Web server that was causing me problems. The main problem was that I couldn't download it, which meant that I couldn't download the whole of my WordPress installation as a backup. I had to copy directories down piecemeal to specifically avoid copying [...]]]></description>
			<content:encoded><![CDATA[<p>I just struggled for a while to delete a symbolic link on my Web server that was causing me problems. The main problem was that I couldn't download it, which meant that I couldn't download the whole of my WordPress installation as a backup. I had to copy directories down piecemeal to specifically avoid copying that file (<strong>advanced-cache.php</strong>).</p>
<p>I'm not sure what the problem was because the file the symlink was pointing to (<strong>wp-content/plugins/wp-cache/wp-cache-phase1.php</strong>) was still there. I had to use ClassicFTP to find this out because FileZilla doesn't show you were a symlink is pointing to. In fact, FileZilla treats symlinks as if they are directories and doesn't show the destination. ClassicFTP does, but doesn't show the ownership or permissions on files, which makes it inferior to FileZilla.</p>
<p>The other problem was that I couldn't simply delete it in FileZilla or ClassicFTP.</p>
<p>The solution I finally found was just to FTP to my Web server from the good old Windows command line. Fire up a command console window, type: <strong>ftp<em> &lt;host&gt;</em></strong> then, when prompted, your user name and password. Use <strong>ls</strong> and <strong>cd</strong> to navigate to the directory containing the symlink.</p>
<p>Strangely, the symlink doesn't show up when you do an <strong>ls</strong>. However, if you do <strong>delete <em>&lt;symlink name&gt;</em></strong> it will delete the symbolic link successfully.</p>
<p>Job done!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2008/10/14/deleting-a-symbolic-link-via-ftp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ubuntu on Virtual PC</title>
		<link>http://www.itauthor.com/2008/09/12/ubuntu-on-virtual-pc/</link>
		<comments>http://www.itauthor.com/2008/09/12/ubuntu-on-virtual-pc/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 11:02:55 +0000</pubDate>
		<dc:creator>ac</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.itauthor.eu/2008/09/12/ubuntu-on-virtual-pc/</guid>
		<description><![CDATA[I'm quite happy using Windows and don't see much appeal in Linux. I have not-so-fond memories of wasting lots of my free time in the past installing and configuring Linux. That was back in the days before graphical Linux installers, when getting a Linux distro to a usable state was a fiendishly complicated ordeal. So [...]]]></description>
			<content:encoded><![CDATA[<p>I'm quite happy using Windows and don't see much appeal in Linux. I have not-so-fond memories of wasting lots of my free time in the past installing and configuring Linux. That was back in the days before graphical Linux installers, when getting a Linux distro to a usable state was a fiendishly complicated ordeal. So I don't have any particular love for Linux as an operating system.</p>
<p>However, it's occasionally useful to have a Linux machine available to test something out, and great way to do this is to use a virtual machine. <a href="http://www.vmware.com/products/player/">VMware</a> would be your first choice if you want a virtual Linux machine, but, with a little effort, you can also use <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=04d26402-3199-48a3-afa2-2dc0b40a73b6&amp;displaylang=en">Microsoft Virtual PC</a>.</p>
<p>Here's how to get Ubuntu on Virtual PC:</p>
<ol>
<li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=04d26402-3199-48a3-afa2-2dc0b40a73b6&amp;displaylang=en">Download and install Virtual PC</a>.       <br />&#160; </li>
<li><a href="http://www.ubuntu.com/getubuntu/download">Download an Ubuntu Desktop Edition ISO</a>. I downloaded 8.04 (&quot;Hardy Heron&quot;).       <br />&#160;&#160; </li>
<li>Start Virtual PC, and <a href="http://arcanecode.wordpress.com/2006/09/20/virtual-pc-step-by-step/">create a new machine</a>.       <br /><embed src="http://v.wordpress.com/uagCcd6h/flv" width="400" height="325" type="application/x-shockwave-flash" flashvars="blog_domain=http://arcanecode.wordpress.com&amp;width=400&amp;height=325" />       <br />(Video by Robert Cain: <a title="http://arcanecode.wordpress.com/" href="http://arcanecode.wordpress.com/">http://arcanecode.wordpress.com/</a>)       <br />&#160;&#160; <br />Note: Make sure to pick &#8220;Other&#8221; as the OS type.       <br />Give the machine 512 MB of RAM.       <br />&#160;&#160; </li>
<li>Start the new virtual machine.      <br />&#160;&#160; </li>
<li>When it starts up, go to the CD menu and choose <strong>Capture ISO image</strong>, pointing it at the desktop ISO you downloaded from Ubuntu. Capturing an image means the ISO file will show up like a CD in the virtual machine.       <br />&#160;&#160; </li>
<li>Ubuntu will start running from the CD image. When it starts, choose your language and then, at the next screen, press F4 to select an alternate starting mode.      <br /><img height="341" alt="ubuntu-install" src="http://www.itauthor.com/wp-content/uploads/2008/09/ubuntu-install.jpg" width="399" border="0" />       <br />&#160;&#160; </li>
<li>When the menu pops up, change to <strong>Safe graphics mode</strong> and press Enter.       <br />There is a problem with the mouse not working in Virtual PC and this takes a little fiddling about to fix it. There is also an issue with sound (see the link at the bottom of this post for details about how to fix that - personally I didn't need sound, so I didn't bother trying to fix that).       <br />&#160;&#160; </li>
<li>Press F6.      <br />&#160; </li>
<li>Edit the command that is displayed, using the arrow keys to move the cursor to the end of the line and adding a space followed by &#8220;noreplace-paravirt&#8221; (without the quote marks) to the end of the command, then press Enter.      <br />&#160;&#160; </li>
<li>Leave the selected option as <strong>Try Ubuntu without any change to your computer</strong>.       <br />Note: do <em>not</em> choose the <strong>Install Ubuntu</strong> option.       <br />&#160;&#160; </li>
<li>After Ubuntu loads (note that at this point it's just running from the CD image, it's not installed on the virtual machine) double-click <strong>Install</strong> on the desktop.       <br />This runs the Ubuntu installer.       <br />&#160;&#160; </li>
<li>Follow through the installer. This part is very simple.      <br />&#160;&#160;&#160; </li>
<li>Once the install is done, go back into the CD menu (right-hand Alt key gets the mouse pointer out of the virtual machine) and release the ISO, otherwise when you reboot you'll go back to the installation menu.      <br />&#160;&#160; </li>
<li>Click the red button, top right of the Ubuntu desktop and shutdown the virtual machine.      <br />If it hangs at this point, don't worry about it.       <br />&#160;&#160; </li>
<li>Close the Virtual PC window and choose to shut down the machine.      <br />&#160; </li>
<li>Go into the Settings for the virtual machine.      <br />Robert Cain's video shows how to edit the Settings if you've never done this before:       <br /><embed src="http://v.wordpress.com/cMPAX2ZR/flv" width="400" height="325" type="application/x-shockwave-flash" flashvars="blog_domain=http://arcanecode.wordpress.com&amp;width=400&amp;height=325" />       <br />&#160; </li>
<li>Make sure Networking is set to the network adaptor that your PC is currently using.      <br />Note: if you want to be able to connect to/from the Ubuntu VM and your host PC, you need to use the Microsoft Loopback Adaptor. If this doesn't show up in the list of network adaptors you'll have to install it first. This is really easy. See <a title="http://support.microsoft.com/kb/839013" href="http://support.microsoft.com/kb/839013">http://support.microsoft.com/kb/839013</a>, or this video from <a title="http://veedee-eyes.com" href="http://veedee-eyes.com">http://veedee-eyes.com</a>       <br /><embed src="http://www.youtube.com/v/uIKOQHbMXOo&amp;color1=0xb1b1b1&amp;color2=0xcfcfcf&amp;hl=en&amp;fs=1" width="425" height="344" type="application/x-shockwave-flash" allowfullscreen="true" />      <br />&#160;&#160; </li>
<li>Save the Settings.     <br />&#160;&#160; </li>
<li>Start up the virtual machine again.      <br />&#160;&#160; </li>
<li>Once it gets to the &quot;GRUB&quot; line, press <strong>Esc</strong>.       <br />You should now see 3 entries to select from.       <br />&#160;&#160; </li>
<li>Leave <strong>Ubuntu 8.04, kernel 2.6.24-16-generic</strong> selected and press <strong>e</strong>.       <br />&#160;&#160; </li>
<li>On the next page, select the second entry that reads <strong>kernel /boot/vmlinuz&#8230;</strong> and press <strong>e</strong> again.       <br />&#160;&#160;&#160; </li>
<li>You will see a command line that ends with &#8220;xforcevesa&#8221;. Edit this, as before, adding a space followed by &#8220;noreplace-paravirt&#8221; (without the quotes) at the end of this line, then press Enter.      <br />&#160;&#160;&#160; <br />You are now back at the previous selection screen with the entry <strong>kernel /boot/vmlinuz&#8230;</strong> still selected.       <br />&#160;&#160; </li>
<li>Press <strong>b</strong> and Ubuntu should boot correctly.       <br />&#160;&#160; </li>
<li>Once Ubuntu has loaded, open a terminal window (<strong>Applications</strong> &gt; <strong>Accessories</strong> &gt; <strong>Terminal</strong>) and on the command line enter:       <br />&#160;&#160;&#160; <br /><font face="Courier New">sudu nano /boot/grub/menu.lst</font>       <br />&#160; </li>
<li>Enter your password and page down to near the bottom and locate &#8220;kernel /boot/vmlinuz&#8230;&quot; in the &#8220;Ubuntu 8.04, kernel 2.6.24-16-generic&#8221; section.      <br />&#160;&#160; </li>
<li>Move the cursor to the end of the line after xforcevesa and add a space followed by &#8220;noreplace-paravirt&#8221; (no quotes).      <br />&#160;&#160; </li>
<li>Ctrl + O to write out.      <br />&#160;&#160; </li>
<li>Enter to accept the name.      <br />&#160; </li>
<li>Ctrl + X to close the file.      <br />&#160;&#160; <br />Ubuntu should now be running inside Virtual PC.      <br />&#160;&#160; </li>
<li>Click the network icon in the upper right side of the Ubuntu toolbar:     <br /><img height="65" alt="ubuntu-network" src="http://www.itauthor.com/wp-content/uploads/2008/09/ubuntu-network.jpg" width="399" border="0" />&#160; <br />&#160;&#160; </li>
<li>Choose <strong>Wired Network</strong>. </li>
</ol>
<p>That's it.</p>
<p>Now you can fire up an Ubuntu machine whenever you need it. And when you close it down, choose <strong>Save State</strong> and when you start it up again you'll be able to pick up exactly where you left off - for example, any programs that were running when you saved state will still be running when you start up the VM again in six months time.</p>
<p> I found the following site extremely helpful:</p>
<p><a title="http://arcanecode.wordpress.com/2008/04/24/installing-ubuntu-804-under-microsoft-virtual-pc-2007/" href="http://arcanecode.wordpress.com/2008/04/24/installing-ubuntu-804-under-microsoft-virtual-pc-2007/">http://arcanecode.wordpress.com/2008/04/24/installing-ubuntu-804-under-microsoft-virtual-pc-2007/</a></p>
<p>If you get stuck, it's worth reading through all the comments on this page, which provide a lot of useful information.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2008/09/12/ubuntu-on-virtual-pc/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Displaying the host name of a UNIX server on login</title>
		<link>http://www.itauthor.com/2007/09/27/displaying-the-host-name-of-a-unix-server-on-login/</link>
		<comments>http://www.itauthor.com/2007/09/27/displaying-the-host-name-of-a-unix-server-on-login/#comments</comments>
		<pubDate>Thu, 27 Sep 2007 19:31:33 +0000</pubDate>
		<dc:creator>ac</dc:creator>
				<category><![CDATA[Shell scripts]]></category>
		<category><![CDATA[UNIX/Linux]]></category>
		<category><![CDATA[View all]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/2007/09/27/displaying-the-host-name-of-a-unix-server-on-login/</guid>
		<description><![CDATA[To show the host name of a server when you log in to it. Add the following at the end of your shell startup file (e.g. .bashrc or .cshrc in your home directory): perl banner.pl Then create the following Perl script in your home directory and call it banner.pl. # Perl script for printing banner [...]]]></description>
			<content:encoded><![CDATA[<p>To show the host name of a server when you log in to it. Add the following at the end of your shell startup file (e.g. <strong>.bashrc</strong> or <strong>.cshrc</strong> in your home directory):</p>
<p><font size="2" face="Courier New">perl banner.pl </font></p>
<p>Then create the following Perl script in your home directory and call it <strong>banner.pl</strong>.</p>
<p><code><font size="2" face="Courier New"># Perl script for printing banner showing name of local host </font></code><code><font size="2" face="Courier New">use Text::Banner;<br />
$a = Text::Banner-&gt;new;<br />
$a-&gt;set(`hostname`);<br />
$a-&gt;size(1);<br />
$a-&gt;fill('');<br />
$a-&gt;rotate('h'); </font></code><code><font size="2" face="Courier New">print "\n";<br />
drawlines();<br />
print $a-&gt;get;<br />
drawlines();<br />
print "\n";<br />
print "\n"; </font></code><code><font size="2" face="cour"><font face="Courier New">sub drawlines() {<br />
<code><font size="2" face="cour"></font></code>&nbsp; &nbsp; for ($loop=1; $loop&lt;4; $loop++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; for ($n=1; $n&lt;60; $n++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print "=";<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; print "\n";<br />
&nbsp; &nbsp; }<br />
}</font> </font></p>
<p></code><code>Finally, install the Text::Banner perl module&nbsp; from CPAN. Note: if you don't want to (or can't) install the Perl module in the normal way on the server, you can&nbsp; download the zip file from the CPAN Web site (<a href="http://search.cpan.org/~lory/Text-Banner-1.00/Banner.pm" title="http://search.cpan.org/~lory/Text-Banner-1.00/Banner.pm">http://search.cpan.org/~lory/Text-Banner-1.00/Banner.pm</a>), <strong>gunzip</strong> and <strong>tar xvf</strong> it&nbsp; in your home directory and then change the 'use' statement to:</code><code><font size="2" face="Courier New">use Banner::Banner; </font></p>
<p>Now, when you log in to the server you get something like this (in this case the server is called pegasus):</p>
<p></code><img border="0" width="488" src="http://www.itauthor.com/wp-content/uploads/2007/09/pegasusbanner.png" alt="pegasusbanner" height="255" style="border: 0px" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2007/09/27/displaying-the-host-name-of-a-unix-server-on-login/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Starting Fedora in text-only or graphical mode</title>
		<link>http://www.itauthor.com/2006/08/09/starting-fedora-in-text-only-or-graphical-mode/</link>
		<comments>http://www.itauthor.com/2006/08/09/starting-fedora-in-text-only-or-graphical-mode/#comments</comments>
		<pubDate>Wed, 09 Aug 2006 13:47:09 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=210</guid>
		<description><![CDATA[The secret to whether your Fedora machine goes into text-only mode or graphical mode on startup is held in the file /etc/inittab If this file contains: id:3:initdefault: Fedora will boot into text-only mode. If the file contains: id:5:initdefault: Fedora will boot into graphical mode.]]></description>
			<content:encoded><![CDATA[<p>The secret to whether your Fedora machine goes into text-only mode or graphical mode on startup is held in the file <strong>/etc/inittab</strong></p>
<p>If this file contains:<br />
<strong>id:3:initdefault:</strong><br />
Fedora will boot into text-only mode.</p>
<p>If the file contains:<br />
<strong>id:5:initdefault:</strong><br />
Fedora will boot into graphical mode.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2006/08/09/starting-fedora-in-text-only-or-graphical-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Graphical remote login</title>
		<link>http://www.itauthor.com/2006/08/09/graphical-remote-login/</link>
		<comments>http://www.itauthor.com/2006/08/09/graphical-remote-login/#comments</comments>
		<pubDate>Wed, 09 Aug 2006 13:40:21 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=209</guid>
		<description><![CDATA[Troubleshooting remote graphical sessions from a Windows PC to a remote Fedora machine. X Sessions 1) Make sure you aren't being blocked by your firewall(s). If you want to establish an X session from a machine on the internal network to a machine in your DMZ (e.g. your web server), you'll need to open up [...]]]></description>
			<content:encoded><![CDATA[<p>Troubleshooting remote graphical sessions from a Windows PC to a remote Fedora machine.</p>
<h2>X Sessions</h2>
<p><strong>1)</strong> Make sure you aren't being blocked by your firewall(s).</p>
<p>If you want to establish an X session from a machine on the internal network to a machine in your DMZ (e.g. your web server), you'll need to open up DMZ pinholes to allow the server in the DMZ to send screen data to ports 6000 (and, for some reason, 6001) on the Windows machine. If you're using Smoothwall you can do this quite easily in the Smoothwall admin pages.</p>
<p>For an X session, check that your firewall on the Windows machine isn't blocking traffic from port 6000 on the Windows machine to port 177 (XDMCP) on the server in the DMZ via the UDP protocol. If the firewall blocks this, the X manager on your Windows PC will not find the DMZ server even if its up and running and listening for connections on port 177.</p>
<p><strong>2)</strong> Check gdm is running:</p>
<p>SSH to the server and enter the command:</p>
<p><strong>ps -ef | grep gdm</strong></p>
<p>This will tell you if gdm has been started.</p>
<p><strong>3)</strong> If it's not running use the command:</p>
<p><strong>gdm &amp;</strong></p>
<p>to start gdm</p>
<p>Be aware that gdm uses up a lot of processing power. If you have your server set up to boot up to run level 3 (text-only login), it will be sitting with a black screen and a login prompt. When you start gdm, this changes to a graphical login (although, of course, you won't see this if the server doesn't have a monitor). So when you've finished your remote X session, you should use the command:</p>
<p><strong>gdm-stop</strong></p>
<p>to stop gdm, switching the local display on the server back to the text-only login.</p>
<h2>VNC</h2>
<p>The main things for troubleshooting VNC are to check that you have SSHed into the server to open up the tunnel to port 590n (e.g. 5903 for display 3).</p>
<p>You should never allow direct VNC access to the server, only via a port forward tunnel opened by an SSH session. This means that your session info for the VNC client will be something like:</p>
<p><strong>localhost:3</strong></p>
<p>Which only works if port 5903 on the machine you're at has been forwarded to port 5903 on the server you've SSHed to.</p>
<p>If you HAVE SSHed to the server and you still don't get the authentication dialog box of your VNC client, check that vncserver is running on the server.</p>
<p>To do this use the command:</p>
<p><strong>ps -ef | grep Xvnc</strong></p>
<p>If there isn't an Xvnc process using display 3, start vncserver, telling it to use display number 3.</p>
<p>To do this, use the command:</p>
<p><strong>vncserver :3</strong></p>
<p>Just remember to stop vncserver after you close your VNC window:</p>
<p><strong>vncserver -kill :3</strong></p>
<p><strong>Note:</strong> VNC may also be blocked by your firewall(s).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2006/08/09/graphical-remote-login/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL log in error</title>
		<link>http://www.itauthor.com/2006/08/01/mysql-log-in-error/</link>
		<comments>http://www.itauthor.com/2006/08/01/mysql-log-in-error/#comments</comments>
		<pubDate>Tue, 01 Aug 2006 08:03:26 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=204</guid>
		<description><![CDATA[If you try to log on to MySQL (e.g. using the simple mysql command) and you get a response like: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) It most likely means your MySQL is set up to authenticate logins and you didn't supply a user name and password. Try: mysql -u [...]]]></description>
			<content:encoded><![CDATA[<p>If you try to log on to MySQL (e.g. using the simple <strong>mysql</strong> command) and you get a response like:</p>
<p><strong>ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)<br />
</strong></p>
<p>It most likely means your MySQL is set up to authenticate logins and you didn't supply a user name and password. Try:</p>
<p><strong>mysql -u root -p</strong></p>
<p>Where <strong>root</strong> is the MySQL user (note: this is not a file system user account, even if it's got the same name as one). You will be prompted to enter the password.</p>
<p>If this still doesn't work, it probably means the user you're trying to log in as hasn't yet been added to MySQL's user database. To add a password for MySQL's <strong>root</strong> user do:</p>
<p><strong>mysqladmin -u root password 'the-new-password'</strong><br />
<span id="more-204"></span><br />
NOTE:</p>
<p>If you forget a password you can do the following:<br />
[Details from: <a href="http://www.idevelopernetwork.com/manual/Page0665.htm">www.idevelopernetwork.com/manual</a>]</p>
<p>1) Stop MySQL by killing the <strong>mysqld</strong> process. The PID for this process is stored in the <strong>mysqld.pid</strong> file in the <strong>mysqld</strong> database directory, so you can stop the process by doing this (as root):</p>
<p><strong>kill `cat /var/run/mysqld/mysqld.pid`</strong></p>
<p>2) Restart mysqld with the --skip-grant-tables option.</p>
<p>3) Set a new password with the mysqladmin password command:</p>
<p><strong>mysqladmin -u root password 'the-new-password'</strong></p>
<p>4) Now you can either stop mysqld and restart it normally, or just load the privilege tables with:</p>
<p><strong>mysqladmin -h hostname flush-privileges</strong></p>
<p>5) After this, you should be able to connect using the new password.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2006/08/01/mysql-log-in-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Tomcat working on Fedora Core 5</title>
		<link>http://www.itauthor.com/2006/07/30/getting-tomcat-working-on-fedora-core-5/</link>
		<comments>http://www.itauthor.com/2006/07/30/getting-tomcat-working-on-fedora-core-5/#comments</comments>
		<pubDate>Sun, 30 Jul 2006 10:10:43 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=203</guid>
		<description><![CDATA[I finally got Tomcat working on my new Fedora Core 5 install. However, I tried so many things, I'm not entirely sure what sorted it. I suspect it was installing tomcat5-webapps. I ran the following commands: yum install tomcat5 yum install tomcat5-webapps yum install tomcat5-admin-webapps Note: yum install tomcat5 did nothing useful because Fedora Core [...]]]></description>
			<content:encoded><![CDATA[<p>I finally got Tomcat working on my new Fedora Core 5 install.</p>
<p>However, I tried so many things, I'm not entirely sure what sorted it. I suspect it was installing tomcat5-webapps. I ran the following commands:</p>
<p>yum install tomcat5<br />
yum install tomcat5-webapps<br />
yum install tomcat5-admin-webapps</p>
<p>Note: yum install tomcat5 did nothing useful because Fedora Core 5 comes with Tomcat 5 and I'd done a complete yum update after installing FC5.</p>
<p>One of the other things I did yesterday was to add the following lines in /etc/httpd/conf/httpd.conf:</p>
<p><strong>LoadModule proxy_ajp_module modules/mod_proxy_ajp.so<br />
ProxyRequests Off</p>
<p># transfer URLs for 'convert'<br />
ProxyPass /convert/ http://localhost.localdomain:8080/convert/<br />
ProxyPassReverse /convert/ http://localhost.localdomain:8080/convert/</p>
<p># transfer URLs for 'hs'<br />
ProxyPass /hs/ http://localhost.localdomain:8080/hs/<br />
ProxyPassReverse /hs/ http://localhost.localdomain:8080/hs/</strong></p>
<p>I then restarted httpd.<br />
And finally, since yesterday, I did a<br />
shutdown -r now</p>
<p>This morning, I browsed to http://localhost:8080 in a browser on the Linux machine and Tomcat works.</p>
<p>I then opened up port 8080 in the firewall, so that I can see the Tomcat home page from other machines on the network by browsing to http://:8080.</p>
<p>So, at last, I've got Tomcat working. Now for Alfresco.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2006/07/30/getting-tomcat-working-on-fedora-core-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling VNC connections</title>
		<link>http://www.itauthor.com/2006/07/28/enabling-vnc-connections/</link>
		<comments>http://www.itauthor.com/2006/07/28/enabling-vnc-connections/#comments</comments>
		<pubDate>Fri, 28 Jul 2006 22:58:35 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=202</guid>
		<description><![CDATA[To VNC to your Linux desktop from a remote PC: 1) On the PC, configure and save a PuTTY session with a tunnel from port 5903 on the local host to port 5903 on the remote (Linux) machine. 2) Use this PuTTY session to connect to the Linux machine. 3) Log in as root. 4) [...]]]></description>
			<content:encoded><![CDATA[<p>To VNC to your Linux desktop from a remote PC:</p>
<p>1) On the PC, configure and save a PuTTY session with a tunnel from port 5903 on the local host to port 5903 on the remote (Linux) machine.</p>
<p>2) Use this PuTTY session to connect to the Linux machine.</p>
<p>3) Log in as root.</p>
<p>4) If you haven't already done so, change the desktop VNC uses from the default twm to either Gnome or KDE by editing your xstartup file:</p>
<p>a) vi ~/.vnc/xstartup</p>
<p>b) For KDE, replace "twm &amp;" with "startkde &amp;".<br />
For Gnome, replace "twm &amp;" with "exec gnome-session &amp;". </p>
<p>c) Enter <strong>vncserver :3</strong><br />
This launches the VNC server and tells it to use display 3.<br />
(The first time you do this you'll be asked to supply a password.)</p>
<p>5) On the PC, start you VNC client (e.g. TightVNC - Fast Compression).</p>
<p>6) VNC to <strong>localhost::5903</strong></p>
<p>7) Enter the password you supplied to vncserver.</p>
<p>You're in.</p>
<p>8) When you're finished, turn off vncserver (for security) by entering:</p>
<p><strong>vncserver -kill :3</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2006/07/28/enabling-vnc-connections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Apache to work on Fedora Core 5</title>
		<link>http://www.itauthor.com/2006/07/28/getting-apache-to-work-on-fedora-core-5/</link>
		<comments>http://www.itauthor.com/2006/07/28/getting-apache-to-work-on-fedora-core-5/#comments</comments>
		<pubDate>Fri, 28 Jul 2006 09:34:19 +0000</pubDate>
		<dc:creator>alistair at work</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=201</guid>
		<description><![CDATA[After installing FC5 yesterday I couldn't get the httpd (Apache) service to start. The problem appears to be with the httpd.conf file (/etc/httpd/conf/httpd.conf). This file contains a large set of LoadModule commands. Seems like these are wrong by default. To correct this, back up the existing file and replace these commands with the following: LoadModule [...]]]></description>
			<content:encoded><![CDATA[<p>After installing FC5 yesterday I couldn't get the httpd (Apache) service to start.</p>
<p>The problem appears to be with the httpd.conf file (/etc/httpd/conf/httpd.conf). This file contains a large set of LoadModule commands. Seems like these are wrong by default.</p>
<p>To correct this, back up the existing file and replace these commands with the following:</p>
<p>LoadModule auth_basic_module modules/mod_auth_basic.so<br />
LoadModule auth_digest_module modules/mod_auth_digest.so<br />
LoadModule authn_file_module modules/mod_authn_file.so<br />
LoadModule authn_alias_module modules/mod_authn_alias.so<br />
LoadModule authn_anon_module modules/mod_authn_anon.so<br />
LoadModule authn_dbm_module modules/mod_authn_dbm.so<br />
LoadModule authn_default_module modules/mod_authn_default.so<br />
LoadModule authz_host_module modules/mod_authz_host.so<br />
LoadModule authz_user_module modules/mod_authz_user.so<br />
LoadModule authz_owner_module modules/mod_authz_owner.so<br />
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so<br />
LoadModule authz_dbm_module modules/mod_authz_dbm.so<br />
LoadModule authz_default_module modules/mod_authz_default.so<br />
LoadModule ldap_module modules/mod_ldap.so<br />
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so<br />
LoadModule include_module modules/mod_include.so<br />
LoadModule log_config_module modules/mod_log_config.so<br />
LoadModule logio_module modules/mod_logio.so<br />
LoadModule env_module modules/mod_env.so<br />
LoadModule ext_filter_module modules/mod_ext_filter.so<br />
LoadModule mime_magic_module modules/mod_mime_magic.so<br />
LoadModule expires_module modules/mod_expires.so<br />
LoadModule deflate_module modules/mod_deflate.so<br />
LoadModule headers_module modules/mod_headers.so<br />
LoadModule usertrack_module modules/mod_usertrack.so<br />
LoadModule setenvif_module modules/mod_setenvif.so<br />
LoadModule mime_module modules/mod_mime.so<br />
LoadModule dav_module modules/mod_dav.so<br />
LoadModule status_module modules/mod_status.so<br />
LoadModule autoindex_module modules/mod_autoindex.so<br />
LoadModule info_module modules/mod_info.so<br />
LoadModule dav_fs_module modules/mod_dav_fs.so<br />
LoadModule vhost_alias_module modules/mod_vhost_alias.so<br />
LoadModule negotiation_module modules/mod_negotiation.so<br />
LoadModule dir_module modules/mod_dir.so<br />
LoadModule actions_module modules/mod_actions.so<br />
LoadModule speling_module modules/mod_speling.so<br />
LoadModule userdir_module modules/mod_userdir.so<br />
LoadModule alias_module modules/mod_alias.so<br />
LoadModule rewrite_module modules/mod_rewrite.so<br />
LoadModule proxy_module modules/mod_proxy.so<br />
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so<br />
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so<br />
LoadModule proxy_http_module modules/mod_proxy_http.so<br />
LoadModule proxy_connect_module modules/mod_proxy_connect.so<br />
LoadModule cache_module modules/mod_cache.so<br />
LoadModule suexec_module modules/mod_suexec.so<br />
LoadModule disk_cache_module modules/mod_disk_cache.so<br />
LoadModule file_cache_module modules/mod_file_cache.so<br />
LoadModule mem_cache_module modules/mod_mem_cache.so<br />
LoadModule cgi_module modules/mod_cgi.so </p>
<p>Save the file and do a:<br />
service httpd start</p>
<p>For me, at least, this solved the problem and Apache started.</p>
<p>However, it seems that if you adjust your Apache settings in FC5 using the GUI tool, it will rebuild the httpd.conf file using the file:<br />
/usr/share/system-config-httpd/httpd.conf.xsl</p>
<p>So you also have to go to this file, back it up, then edit it in the same way you did the httpd.conf file - replacing the LoadModule list.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2006/07/28/getting-apache-to-work-on-fedora-core-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Turning off/on SELinux</title>
		<link>http://www.itauthor.com/2006/07/27/turning-offon-selinux/</link>
		<comments>http://www.itauthor.com/2006/07/27/turning-offon-selinux/#comments</comments>
		<pubDate>Thu, 27 Jul 2006 21:56:37 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=200</guid>
		<description><![CDATA[I'm still trying to get Tomcat working on my new Fedora Core 5 install. One thing I've found in the past with Fedora is that SELinux is enabled by default and its strictness interferes with things to the point that it can be a real pain. As a result I find it's best to turn [...]]]></description>
			<content:encoded><![CDATA[<p>I'm still trying to get Tomcat working on my new Fedora Core 5 install. One thing I've found in the past with Fedora is that SELinux is enabled by default and its strictness interferes with things to the point that it can be a real pain. As a result I find it's best to turn it off to start with while you're having the usual Linux struggle to get things to work.</p>
<p>A clever too for adjusting your Fedora firewall and disabling SELinux is  system-config-securitylevel, which you can call from the command line with just its name (because it's in /usr/bin). The clever thing I just found out about it is that even connecting remotely from a Windows laptop to your Linux machine, via a PuTTY SSH session, it will pop-up a GUI window and allow you to reconfigure the settings point-and-click style.</p>
<p>Tomcat's still not working though!<br />
<span id="more-200"></span><br />
Note:<br />
The command /usr/sbin/getenforce displays the current SELinux level: Enforcing, Permissive or Disabled.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2006/07/27/turning-offon-selinux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing the display resolution on Fedora</title>
		<link>http://www.itauthor.com/2006/07/27/changing-the-display-resolution-on-fedora/</link>
		<comments>http://www.itauthor.com/2006/07/27/changing-the-display-resolution-on-fedora/#comments</comments>
		<pubDate>Thu, 27 Jul 2006 16:25:38 +0000</pubDate>
		<dc:creator>alistair at work</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=199</guid>
		<description><![CDATA[I'm in the process of trying to get Tomcat running on Fedora Core 5 - which I've just finished installing. The FC5 has taken most of the day to install from the 5 CDs onto an old, slow PC with very little memory. So little memory, in fact, that it refused to install in graphical [...]]]></description>
			<content:encoded><![CDATA[<p>I'm in the process of trying to get Tomcat running on Fedora Core 5 - which I've just finished installing. The FC5 has taken most of the day to install from the 5 CDs onto an old, slow PC with very little memory. So little memory, in fact, that it refused to install in graphical mode and when the install completed it left me at a command prompt, rather than a desktop. OK, little reminder from a collegue and I started up X, using the startx command, which launched Gnome. I then had to change the run level from 3 to 5 in the inittab file, to get this to go to the desktop next time round.</p>
<p>I'd forgotten how much faffing around is involved with Linux. I'm using a little 15" flat screen monitor and I changed the resolution from 800x600 to something higher, at which point the screen refused to display and I had to trawl the internet (via Windows on another machine) to find the solution, which is:</p>
<p>use the key combo:<br />
Ctrl + Alt + [plus or minus key on the number pad] to cycle through screen resolutions.</p>
<p>Meanwhile, Tomcat is still proving troublesome to get up &amp; running.</p>
<p>All this just so's I can install the trial version of Alfresco!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2006/07/27/changing-the-display-resolution-on-fedora/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handy ls flags</title>
		<link>http://www.itauthor.com/2006/05/11/handy-ls-flags/</link>
		<comments>http://www.itauthor.com/2006/05/11/handy-ls-flags/#comments</comments>
		<pubDate>Thu, 11 May 2006 10:18:22 +0000</pubDate>
		<dc:creator>alistair at work</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=197</guid>
		<description><![CDATA[To sort ls output by date (or more specifically by last modification time), use the -t flag. To reverse the sort, use the -r flag. To restrict the output to a single column, use the -1 flag (that's a number one). So, all together, to reverse sort the listing by date and format the list [...]]]></description>
			<content:encoded><![CDATA[<p>To sort ls output by date (or more specifically by last modification time), use the <strong>-t</strong> flag.</p>
<p>To reverse the sort, use the <strong>-r</strong> flag.</p>
<p>To restrict the output to a single column, use the <strong>-1</strong> flag (that's a number one).</p>
<p>So, all together, to reverse sort the listing by date and format the list in one column, use the command:</p>
<p><strong>ls -tr1</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2006/05/11/handy-ls-flags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding users &amp; groups on Solaris</title>
		<link>http://www.itauthor.com/2006/03/20/adding-users-groups-on-solaris/</link>
		<comments>http://www.itauthor.com/2006/03/20/adding-users-groups-on-solaris/#comments</comments>
		<pubDate>Mon, 20 Mar 2006 12:39:00 +0000</pubDate>
		<dc:creator>alistair at work</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=189</guid>
		<description><![CDATA[To create a group: groupadd &#60;groupname&#62; To create a user, create their home directory and add them to a group: useradd -m -d &#60;path/to/home/username&#62; -g &#60;groupname&#62; &#60;username&#62; To add an existing user to a group: usermod -g &#60;groupname&#62; &#60;username&#62;]]></description>
			<content:encoded><![CDATA[<p>To create a group: </p>
<pre>groupadd &lt;groupname&gt;</pre>
<p>To create a user, create their home directory and add them to a group:</p>
<pre>useradd -m -d &lt;path/to/home/username&gt; -g &lt;groupname&gt; &lt;username&gt;</pre>
<p>To add an existing user to a group: </p>
<pre>usermod -g &lt;groupname&gt; &lt;username&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2006/03/20/adding-users-groups-on-solaris/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding files that contain certain text</title>
		<link>http://www.itauthor.com/2005/12/11/finding-files-that-contain-certain-text/</link>
		<comments>http://www.itauthor.com/2005/12/11/finding-files-that-contain-certain-text/#comments</comments>
		<pubDate>Sun, 11 Dec 2005 22:25:11 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=173</guid>
		<description><![CDATA[I keep forgetting how to do this and then having to look it up. So here, for quicker access next time I forget, is how it's done: To find files in or below the current directory that contain the text string "if I only had a brain" enter the command: find . -type f -print [...]]]></description>
			<content:encoded><![CDATA[<p>I keep forgetting how to do this and then having to look it up. So here, for quicker access next time I forget, is how it's done:</p>
<p>To find files in or below the current directory that contain the text string "if I only had a brain" enter the command:</p>
<p><strong>find . -type f -print | xargs grep 'if I only had a brain' | more</strong></p>
<p>Thanks to:<br />
<a href="http://www.geocities.com/samarstan/linux/penguin/linuxuser.html?200511">www.geocities.com/samarstan/linux/penguin/linuxuser.html</a><br />
for reminding me how it was done on this occasion.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2005/12/11/finding-files-that-contain-certain-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find a host name given an IP address</title>
		<link>http://www.itauthor.com/2005/11/08/find-a-host-name-given-an-ip-address/</link>
		<comments>http://www.itauthor.com/2005/11/08/find-a-host-name-given-an-ip-address/#comments</comments>
		<pubDate>Tue, 08 Nov 2005 14:31:55 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=166</guid>
		<description><![CDATA[Question: I'm logged in to a UNIX machine. How do I find out the host name of a computer on the local network if I only have its IP address? Answer: Use the command: ypcat hosts &#124; grep "&#60;IP address&#62;&#160;&#160;&#160;&#160;" Where that space before the closing quote is a tab that you enter by pressing [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Question</strong>:<br />
I'm logged in to a UNIX machine. How do I find out the host name of a computer on the local network if I only have its IP address?</p>
<p><strong>Answer</strong>:<br />
Use the command:<br />
<strong>ypcat hosts | grep "<em>&lt;IP address&gt;</em>&nbsp;&nbsp;&nbsp;&nbsp;"</strong></p>
<p>Where that space before the closing quote is a tab that you enter by pressing the TAB key.</p>
<p>Note: If you're in the bash shell you will need to press Ctrl+v before pressing TAB. Ctrl+v means "treat what I type next literally". (You're most likely to use it in vi when you want to enter or search for a control character. For example, if you want to delete all Ctrl+M characters you can enter :%s/^M$//g by pressing Ctrl+v Ctrl+M to give you the ^M character.)</p>
<p>For example, if you enter:</p>
<p><strong>ypcat hosts | grep "192.100.123.456&nbsp;&nbsp;&nbsp;&nbsp;"</strong></p>
<p>The output will be something like:</p>
<p>192.100.123.456  hermes.yourorg.com hermes<br />
192.100.123.456  hermes.yourorg.com hermes</p>
<p>In which case the host name is <strong>hermes</strong>.</p>
<p><em>See also:<br />
<a href="http://www.itauthor.com/notes/archives/2004/04/find_an_ip_addr.html">Find an IP address given a host name</a></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2005/11/08/find-a-host-name-given-an-ip-address/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Listing the files/directories in a directory</title>
		<link>http://www.itauthor.com/2005/06/02/listing-the-filesdirectories-in-a-directory/</link>
		<comments>http://www.itauthor.com/2005/06/02/listing-the-filesdirectories-in-a-directory/#comments</comments>
		<pubDate>Thu, 02 Jun 2005 16:20:43 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=149</guid>
		<description><![CDATA[In UNIX I enter the command ls and I get back a list of files and directories in the current directory. The trouble is, there's no way of knowing which are files and which are directories. What I really need is just a list of the files (not the directories), one per line, so that [...]]]></description>
			<content:encoded><![CDATA[<p>In UNIX I enter the command <strong>ls</strong> and I get back a list of files and directories in the current directory. The trouble is, there's no way of knowing which are files and which are directories. What I really need is just a list of the files (not the directories), one per line, so that I can copy this into some document or program.</p>
<p>The first step is to use a long listing <strong>ls -l</strong> rather than just <strong>ls</strong>.</p>
<p>This lists the directory contents one per line, giving lots of information about each file and directory. The listing comprises 9 columns. If the first column start with a 'd' the item is a directory. If it starts with a '-', it's a file. The last column of the listing contains the file/directory names.</p>
<p>So what I want to do is:<br />
1) Do a long listing.<br />
2) Filter out the directories, based on the first letter of each line.<br />
3) Remove everything except the last column, so that I have a simple list of files.</p>
<p>This is easily done using <strong>grep</strong> to filter out the listing and <strong>awk</strong> to print just column number 9. The following command uses pipes to pass the output from <strong>ls</strong> to <strong>grep</strong> and then on to <strong>awk</strong>:</p>
<p><strong>ls -l | grep '^-' | awk '{print $9}'</strong></p>
<p>If I'd wanted a list of directories, I could have changed the '-' to 'd':</p>
<p><strong>ls -l | grep '^d' | awk '{print $9}'</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2005/06/02/listing-the-filesdirectories-in-a-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What version of Solaris</title>
		<link>http://www.itauthor.com/2005/04/05/what-version-of-solaris/</link>
		<comments>http://www.itauthor.com/2005/04/05/what-version-of-solaris/#comments</comments>
		<pubDate>Tue, 05 Apr 2005 12:49:57 +0000</pubDate>
		<dc:creator>alistair at work</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=134</guid>
		<description><![CDATA[To find out what version of Solaris a server is running, use the command: uname -a This returns something like: SunOS sandbox 5.8 Generic_108528-13 sun4u sparc SUNW,Sun-Fire-280R SunOS 5.6 is Solaris 2.6 SunOS 5.7 is Solaris 7 SunOS 5.8 is Solaris 8]]></description>
			<content:encoded><![CDATA[<p>To find out what version of Solaris a server is running, use the command:</p>
<p><strong>uname -a</strong></p>
<p>This returns something like:</p>
<p><strong>SunOS sandbox 5.8 Generic_108528-13 sun4u sparc SUNW,Sun-Fire-280R</strong></p>
<p>SunOS 5.6 is Solaris 2.6<br />
SunOS 5.7 is Solaris 7<br />
SunOS 5.8 is Solaris 8</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2005/04/05/what-version-of-solaris/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using what to display version details</title>
		<link>http://www.itauthor.com/2005/03/15/using-what-to-display-version-details/</link>
		<comments>http://www.itauthor.com/2005/03/15/using-what-to-display-version-details/#comments</comments>
		<pubDate>Tue, 15 Mar 2005 11:58:00 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=131</guid>
		<description><![CDATA[Programs and scripts often containg code to allow you to run the program with a flag such as -v or --version to return the version number. An easy way to allow version details to be displayed is to use the UNIX what command. Users then use the command what yourprogram to see the version details. [...]]]></description>
			<content:encoded><![CDATA[<p>Programs and scripts often containg code to allow you to run the program with a flag such as <strong>-v</strong> or <strong>--version</strong> to return the version number.</p>
<p>An easy way to allow version details to be displayed is to use the UNIX <strong>what</strong> command.</p>
<p>Users then use the command what yourprogram to see the version details.</p>
<p>To implement this, add a line in your program containing the text string <strong>@(#)</strong> followed by whatever version details you want to give, followed by a double-quote mark or a line break.<br />
<span id="more-131"></span><br />
For example, create a text file called <strong>what.txt</strong> containing the following:</p>
<pre>Version numbers

To use the UNIX 'what' command
to return version information,
add a text string begining with an @ symbol
followed by (#) and everything following this,
until the line ending or a double quote
is returned to standard output by the
'who' command.

For example:
@(#)Version 1.0 - 'what' command explanation

Now if you run the command
what
you will see:
Version 1.0 - 'what' command explanation

See
man what
for more information.</pre>
<p>Now run the command <strong>what what.txt</strong> and <strong>what</strong> prints the message:</p>
<pre>Version 1.0 - 'what' command explanation</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2005/03/15/using-what-to-display-version-details/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring vi</title>
		<link>http://www.itauthor.com/2005/03/15/configuring-vi/</link>
		<comments>http://www.itauthor.com/2005/03/15/configuring-vi/#comments</comments>
		<pubDate>Tue, 15 Mar 2005 11:52:16 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=130</guid>
		<description><![CDATA[The configuration file for vi is called .exrc and it lives in your home directory. To change your default vi settings, edit ~/.exrc. For example, add: set showmode set number This displays the current mode (e.g. "INSERT MODE") and displays line numbers. To temporarily remove the line numbers (e.g. so that you can copy lines [...]]]></description>
			<content:encoded><![CDATA[<p>The configuration file for vi is called <strong>.exrc</strong> and it lives in your home directory.</p>
<p>To change your default vi settings, edit <strong>~/.exrc</strong>. For example, add:</p>
<p><strong>set showmode<br />
set number</strong></p>
<p>This displays the current mode (e.g. "INSERT MODE") and displays line numbers. </p>
<p>To temporarily remove the line numbers (e.g. so that you can copy lines without copying the numbers) use the following command in vi:</p>
<p><strong>:set nonu</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2005/03/15/configuring-vi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using yum to download and maintain RPM packages</title>
		<link>http://www.itauthor.com/2005/02/25/using-yum-to-download-and-maintain-rpm-packages/</link>
		<comments>http://www.itauthor.com/2005/02/25/using-yum-to-download-and-maintain-rpm-packages/#comments</comments>
		<pubDate>Fri, 25 Feb 2005 23:01:25 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=126</guid>
		<description><![CDATA[If you're using Fedora and you're not using yum, you ought to start using it - I just have! It makes the process of installing Linux software so much easier. Whereas when you install packages using the rpm command you often get "failed dependencies" messages, with yum it just goes off and installs the dependent [...]]]></description>
			<content:encoded><![CDATA[<p>If you're using Fedora and you're not using <strong>yum</strong>, you ought to start using it - I just have! It makes the process of installing Linux software <em>so</em> much easier. Whereas when you install packages using the <strong>rpm</strong> command you often get "failed dependencies" messages, with <strong>yum</strong> it just goes off and installs the dependent packages for you as well.</p>
<p>The only fly in the ointment is a little tiny gnat that you can soon get rid of. The first time you try to use yum you will probably get a message like:</p>
<pre>You have enabled checking of packages via GPG keys. This is a good thing.
However, you do not have any GPG public keys installed. You need to download
the keys for packages you wish to install and install them.
You can do that by running the command:
    rpm --import public.gpg.key
For more information contact your distribution or package provider.</pre>
<p>This means you need to tell yum who it can trust. You do this by installing Fedora security keys:</p>
<pre>rpm --import /usr/share/rhn/RPM-GPG-KEY*</pre>
<p><strong>Note</strong><br />
You have to do all this as root.</p>
<p>For more information, see:<br />
<a href="http://www.hut.fi/~tkarvine/yum-package-manager.html">www.hut.fi/~tkarvine/yum-package-manager.html</a><br />
<span id="more-126"></span><br />
You can use <strong>yum</strong> to update your whole system, and it's recommended that you do this every now and again. However, be advised, the first time you do this it's going to take a long while. First <strong>yum</strong> produces a list of everything that needs to be updated. This takes a while, at the end of which you are asked to confirm that it's okay for <strong>yum</strong> to proceed. If you answer yes, <strong>yum</strong> will start downloading all of the necessary packages. </p>
<p>As I write, <strong>yum</strong> is still updating 383 packages on my Fedora machine, so I can't tell you how long it's likely to take, but I think it's been running for about an hour already!</p>
<p>To update your system, enter the command:</p>
<pre>yum update</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2005/02/25/using-yum-to-download-and-maintain-rpm-packages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Checking whether you have an RPM installed</title>
		<link>http://www.itauthor.com/2005/02/25/checking-whether-you-have-an-rpm-installed/</link>
		<comments>http://www.itauthor.com/2005/02/25/checking-whether-you-have-an-rpm-installed/#comments</comments>
		<pubDate>Fri, 25 Feb 2005 21:27:34 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=125</guid>
		<description><![CDATA[Q: What do you do when you want to check that you have a particular Linux RPM installed, but you can't remember exactly what it was called? A: Run an RPM query to return the details of all the installed RPMs, and use grep to filter the results. For example, I just wanted to check [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Q</strong>: What do you do when you want to check that you have a particular Linux RPM installed, but you can't remember exactly what it was called?</p>
<p><strong>A</strong>: Run an RPM query to return the details of <em>all</em> the installed RPMs, and use grep to filter the results.</p>
<p>For example, I just wanted to check which DocBook RPMs, if any, were installed on my machine. The command:</p>
<pre>rpm -qa|grep -i docbook</pre>
<p>Yielded the reply:</p>
<pre>docbook-slides-3.3.1-2
docbook-dtds-1.0-25
docbook-simple-1.0-2
docbook-style-xsl-1.65.1-2
docbook-utils-0.6.14-4
docbook-utils-pdf-0.6.14-4
docbook-style-dsssl-1.78-4</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2005/02/25/checking-whether-you-have-an-rpm-installed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Checking/resetting the date/time</title>
		<link>http://www.itauthor.com/2005/02/22/checkingresetting-the-datetime/</link>
		<comments>http://www.itauthor.com/2005/02/22/checkingresetting-the-datetime/#comments</comments>
		<pubDate>Tue, 22 Feb 2005 09:02:36 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=119</guid>
		<description><![CDATA[To check whether the date/time is correct on your Linux machine, enter the command: date And compare the results with the output of the command: rdate -p &#60;server&#62; where server is one of the following: table.bespoke { border: 1px hidden #342DAC; border-collapse: collapse; background-color: #F3FEFF; } table.bespoke th { border: 1px outset #342DAC; background-color: #FFFFF0; [...]]]></description>
			<content:encoded><![CDATA[<p>To check whether the date/time is correct on your Linux machine, enter the command:</p>
<p><b>date</b></p>
<p>And compare the results with the output of the command:</p>
<p><b>rdate -p</b> <i>&lt;server&gt;</i></p>
<p>where server is one of the following:</p>
<p>table.bespoke {<br />
	border: 1px hidden #342DAC;<br />
	border-collapse: collapse;<br />
	background-color: #F3FEFF;<br />
}<br />
table.bespoke th {<br />
	border: 1px outset #342DAC;<br />
	background-color: #FFFFF0;<br />
}<br />
table.bespoke td {<br />
	border: 1px outset #342DAC;<br />
        padding: 2px;<br />
}<br />
table.bespoke .country {<br />
	text-align: center;<br />
}</p>
<table>
<tr>
<th>Server</th>
<th>Country</th>
</tr>
<tr>
<td>ntp.demon.co.uk</td>
<td>UK</td>
</tr>
<tr>
<td>nist1.datum.com</td>
<td>US</td>
</tr>
<tr>
<td>time-b.nist.gov</td>
<td>US</td>
</tr>
<tr>
<td>time.nist.gov</td>
<td>US</td>
</tr>
<tr>
<td>utcnist.colorado.edu</td>
<td>US</td>
</tr>
<tr>
<td>mizbeaver.udel.edu</td>
<td>US</td>
</tr>
</table>
<p>For example:</p>
<pre># <b>date</b>
Tue Feb 22 08:55:06 GMT 2005
# <b>rdate -p ntp.demon.co.uk</b>
rdate: [ntp.demon.co.uk]        Tue Feb 22 08:50:14 2005</pre>
<p>In the above example, the local machine is about 5 minutes fast.</p>
<p><b>rdate -p</b> <i>&lt;server&gt;</i></p>
<p>prints the date from the remote server.</p>
<p>To set your Linux machine to that date, use:</p>
<p><b>rdate -s</b> <i>&lt;server&gt;</i></p>
<p>For example:</p>
<p><b>rdate -s ntp.demon.co.uk</b></p>
<p>You can use ntpd to check and set your time on a regular basis, but if keeping accurate time isn't critical for you, the occasional manual check and reset is all you need.</p>
<p>For more information, see: <a href="http://linuxreviews.org/howtos/ntp/">http://linuxreviews.org/howtos/ntp/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2005/02/22/checkingresetting-the-datetime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pgrep and pkill</title>
		<link>http://www.itauthor.com/2005/02/11/pgrep-and-pkill/</link>
		<comments>http://www.itauthor.com/2005/02/11/pgrep-and-pkill/#comments</comments>
		<pubDate>Fri, 11 Feb 2005 12:40:08 +0000</pubDate>
		<dc:creator>alistair at work</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=112</guid>
		<description><![CDATA[My colleague John Page this morning introduced me to the pgrep and pkill commands, as a useful replacement for grepping the output of ps. I'd never heard of either command (probably because they're not in my copy of UNIX Complete - probably because it's from 1999). Using pkill allows me to replace the following, from [...]]]></description>
			<content:encoded><![CDATA[<p>My colleague John Page this morning introduced me to the <strong>pgrep</strong> and <strong>pkill</strong> commands, as a useful replacement for grepping the output of <strong>ps</strong>.</p>
<p>I'd never heard of either command (probably because they're not in my copy of <em>UNIX Complete</em> - probably because it's from 1999).</p>
<p>Using <strong>pkill</strong> allows me to replace the following, from a shell script that stops or starts a program called <strong>lmgrd</strong>:</p>
<p><strong>kill `ps -ef | grep "lmgrd -c" | grep -v grep | awk '{print $2}'`</strong></p>
<p>with this:</p>
<p><strong>pkill lmgrd</strong></p>
<p>Check out the man page for pgrep and pkill (or read it online at <a href="http://linux.about.com/library/cmd/blcmdl1_pgrep.htm">http://linux.about.com/library/cmd/blcmdl1_pgrep.htm</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2005/02/11/pgrep-and-pkill/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding a path to your PATH</title>
		<link>http://www.itauthor.com/2005/02/02/adding-a-path-to-your-path/</link>
		<comments>http://www.itauthor.com/2005/02/02/adding-a-path-to-your-path/#comments</comments>
		<pubDate>Wed, 02 Feb 2005 09:17:30 +0000</pubDate>
		<dc:creator>alistair at work</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=106</guid>
		<description><![CDATA[To add a path to your PATH variable edit your shell initialization file(s) as follows. C shell (csh) To add your home directory (~) to your PATH, add the following to the .cshrc file in your home directory: set path = ($path ~) Bourne shell (bash) To add your home directory (~) to your PATH, [...]]]></description>
			<content:encoded><![CDATA[<p>To add a path to your PATH variable edit your shell initialization file(s) as follows.</p>
<p><strong>C shell </strong>(csh)<br />
To add your home directory (~) to your PATH, add the following to the .cshrc file in your home directory:<br />
set path = ($path ~)</p>
<p><strong>Bourne shell</strong> (bash)<br />
To add your home directory (~) to your PATH, add the following to the .bashrc file in your home directory:<br />
PATH="$PATH:~"; export PATH<br />
<span id="more-106"></span><br />
Your changes take affect the next time you log in. To apply your changes now, run the following commands.</p>
<p><strong>C shell </strong>(csh)<br />
source .cshrc</p>
<p><strong>Bourne shell</strong> (bash)<br />
. .profile</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2005/02/02/adding-a-path-to-your-path/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding whether a user account already exists</title>
		<link>http://www.itauthor.com/2005/01/13/finding-whether-a-user-account-already-exists/</link>
		<comments>http://www.itauthor.com/2005/01/13/finding-whether-a-user-account-already-exists/#comments</comments>
		<pubDate>Thu, 13 Jan 2005 10:57:13 +0000</pubDate>
		<dc:creator>alistair at work</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=104</guid>
		<description><![CDATA[Provided you can log on as root, you can search the passwd file to find out whether a user account with a particular name already exists. For example, to check whether there's a user called alistair, run the following command: cat /etc/passwd &#124; grep "^alistair" Note: This will also find users called "alistair1", "alistair2" etc. [...]]]></description>
			<content:encoded><![CDATA[<p>Provided you can log on as <strong>root</strong>, you can search the <strong>passwd</strong> file to find out whether a user account with a particular name already exists.</p>
<p>For example, to check whether there's a user called alistair, run the following command:</p>
<p><strong>cat /etc/passwd | grep "^alistair"</strong></p>
<p>Note: This will also find users called "alistair1", "alistair2" etc. If you grep for just "alistair", you will find users like "thisalistair" and thatalistair".</p>
<p>Search the <strong>group</strong> file in the same way to check for existing groups. For example:</p>
<p><strong>cat /etc/group | grep "^adminusers"</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2005/01/13/finding-whether-a-user-account-already-exists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding free space on Linux</title>
		<link>http://www.itauthor.com/2005/01/04/finding-free-space-on-linux/</link>
		<comments>http://www.itauthor.com/2005/01/04/finding-free-space-on-linux/#comments</comments>
		<pubDate>Tue, 04 Jan 2005 09:26:04 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=98</guid>
		<description><![CDATA[My brain is very efficient at freeing up space by deleting old data that hasn't been accessed for a while - i.e. if I don't use it I forget it. A case in point is how to find out how much space you have left on a Linux machine. The answer, of course, is to [...]]]></description>
			<content:encoded><![CDATA[<p>My brain is very efficient at freeing up space by deleting old data that hasn't been accessed for a while - i.e. if I don't use it I forget it.</p>
<p>A case in point is how to find out how much space you have left on a Linux machine.</p>
<p>The answer, of course, is to use the <strong>df </strong>command. For example:</p>
<pre># <strong>df -h</strong>
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda3              73G  3.0G   66G   5% /
/dev/hda1             244M  8.7M  222M   4% /boot
none                  157M     0  157M   0% /dev/shm
/dev/hdb1             7.8G  183M  7.2G   3% /home</pre>
<p>The <strong>-h</strong> flag here outputs the results in human-readable format - i.e. it appends M for megabytes and G for gigabytes, rather than printing everything in kilobytes.<br />
<span id="more-98"></span><br />
To find out stuff like this you can, of course, search the Internet. But a more efficient way - at least for starters - is to search the man system using the <strong>apropos</strong> command.</p>
<p>For example, to search for man pages that mention "disk space":</p>
<pre># <strong>apropos 'disk space'</strong></pre>
<p>When I do this, the result is:</p>
<pre>df        (1)  - report filesystem disk space usage</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2005/01/04/finding-free-space-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to tell who&#8217;s edited something in CVS</title>
		<link>http://www.itauthor.com/2004/12/06/how-to-tell-whos-edited-something-in-cvs/</link>
		<comments>http://www.itauthor.com/2004/12/06/how-to-tell-whos-edited-something-in-cvs/#comments</comments>
		<pubDate>Mon, 06 Dec 2004 08:06:19 +0000</pubDate>
		<dc:creator>alistair at work</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=87</guid>
		<description><![CDATA[This command will show a list of people who have edited a file: cvs log &#60;filename&#62; &#124; grep author &#124; awk '{print $5}' &#124; sort -u Replace &#60;filename&#62; with a real value. Thanks to Sandy Dunlop for this tip.]]></description>
			<content:encoded><![CDATA[<p>This command will show a list of people who have edited a file:</p>
<p><strong>cvs log &lt;filename&gt; | grep author | awk '{print $5}' | sort -u</strong></p>
<p>Replace &lt;filename&gt; with a real value.</p>
<p><em>Thanks to <a href="http://www.sorn.net/sandy/index.php">Sandy Dunlop</a> for this tip.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2004/12/06/how-to-tell-whos-edited-something-in-cvs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A simple use of sed</title>
		<link>http://www.itauthor.com/2004/05/26/a-simple-use-of-sed/</link>
		<comments>http://www.itauthor.com/2004/05/26/a-simple-use-of-sed/#comments</comments>
		<pubDate>Wed, 26 May 2004 14:19:40 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=74</guid>
		<description><![CDATA[sed and awk are programs I usually get by without, but here's a handy use for sed. Say you've got a file called johnbrown.txt containing the following text: This file is the property of John Brown. John Brown will be very annoyed if anyone alters it. Signed: John Brown. Run the following command: sed -e [...]]]></description>
			<content:encoded><![CDATA[<p>sed and awk are programs I usually get by without, but here's a handy use for sed.</p>
<p>Say you've got a file called johnbrown.txt containing the following text:</p>
<p><i>This file is the property of John Brown.<br />
John Brown will be very annoyed if anyone alters it.<br />
Signed: John Brown.</i></p>
<p>Run the following command:</p>
<p>sed -e s/John Brown/Jill Green/g johnbrown.txt &gt; jillgreen.txt</p>
<p>You now have a new file containing the following: </p>
<p><i>This file is the property of Jill Green.<br />
Jill Green will be very annoyed if anyone alters it.<br />
Signed: Jill Green.</i></p>
<p>Not much use for a three-line file, but very handy for a 3000-line file.</p>
<p>Find out more about sed at:<br />
<a href="http://pegasus.rutgers.edu/~elflord/unix/sed.html">http://pegasus.rutgers.edu/~elflord/unix/sed.html</a></p>
<p>If you want to do anything more complex than this (i.e. match whole words only, or match across multiple lines) then you can do it in sed, but it's painful. You're much better switching over to Windows and using <a href="http://www.eluent.com/">Replace from Eluent Tools</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2004/05/26/a-simple-use-of-sed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SFU 3.5 extras</title>
		<link>http://www.itauthor.com/2004/05/13/sfu-35-extras/</link>
		<comments>http://www.itauthor.com/2004/05/13/sfu-35-extras/#comments</comments>
		<pubDate>Thu, 13 May 2004 16:30:10 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=71</guid>
		<description><![CDATA[SFU 3.5 is excellent value for money (at $0) but lacks a few common UNIX programs/utilities. However, additional components for SFU3.5 are available for free download from Interop Systems: www.interopsystems.com/tools/warehouse.htm For example: OpenSSH bash vim Apache To install these, you need to install the package installer. You do this by going to: ftp://ftp.interopsystems.com/pkgs/3.5/ and downloading [...]]]></description>
			<content:encoded><![CDATA[<p>SFU 3.5 is excellent value for money (at $0) but lacks a few common UNIX programs/utilities. However, additional components for SFU3.5 are available for free download from Interop Systems:</p>
<p><a href="http://www.interopsystems.com/tools/warehouse.htm">www.interopsystems.com/tools/warehouse.htm</a></p>
<p>For example:</p>
<p>OpenSSH<br />
bash<br />
vim<br />
Apache</p>
<p>To install these, you need to install the package installer.<br />
You do this by going to:</p>
<p><a href="ftp://ftp.interopsystems.com/pkgs/3.5/">ftp://ftp.interopsystems.com/pkgs/3.5/</a></p>
<p>and downloading a shell script called pkg-1.6-bin35.sh, or similar (there might be a newer release by the time you read this). For example, save it to your SFU root directory (usually C:\SFU).</p>
<p>After downloading, run the script from an SFU shell prompt.</p>
<p>This adds the programs <b>pkg_add</b>, <b>pkg_info</b>, <b>pkg_delete</b>, <b>pkg_create </b>and <b>pkg_sign </b>to <b>/usr/local/bin</b>.</p>
<p>Download the package you want to install (e.g. OpenSSH at <a href="ftp://ftp.interopsystems.com/pkgs/3.5/openssh-current-bin.tgz">ftp://ftp.interopsystems.com/pkgs/3.5/openssh-current-bin.tgz</a>) unzip it, then run the package installer on it, e.g:</p>
<p><b>pkg_add openssh-current-bin.tar</b></p>
<p>The above example adds SSH, so that you can login to the machine using SSH (e.g. using PuTTY).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2004/05/13/sfu-35-extras/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use tr to transform a text string</title>
		<link>http://www.itauthor.com/2004/04/20/use-tr-to-transform-a-text-string/</link>
		<comments>http://www.itauthor.com/2004/04/20/use-tr-to-transform-a-text-string/#comments</comments>
		<pubDate>Tue, 20 Apr 2004 09:23:46 +0000</pubDate>
		<dc:creator>alistair at work</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=68</guid>
		<description><![CDATA[Problem: In a shell script to back up a directory, you want to save the directory as a tar file whose name includes the full original path (just in case you have multiple directories, in separate locations, with the same name). So you want to save a directory with the path /dev/fs/D/mydir to a tar [...]]]></description>
			<content:encoded><![CDATA[<p>Problem:<br />
In a shell script to back up a directory, you want to save the directory as a tar file whose name includes the full original path (just in case you have multiple directories, in separate locations, with the same name). So you want to save a directory with the path <b>/dev/fs/D/mydir</b> to a tar file called <b>BACKUP_.dev.fs.D.mydir</b>.</p>
<p>Solution:<br />
Use <b>tr</b> to transform the path string. For example, the path to the directory you are backing up (<b>/dev/fs/D/mydir</b>) is stored in the variable $DIRECTORY. Use the following commands to create a variable called $NAME containing <b>BACKUP_.dev.fs.D.mydir</b>.</p>
<p><b>NAME = `echo $DIRECTORY | tr '/' '.'`<br />
NAME = BACKUP_`echo $NAME | tr '\' '.'`</b></p>
<p>Note: don't mix up the backticks and the single quotes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2004/04/20/use-tr-to-transform-a-text-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using rcp and cron to perform a scheduled network backup</title>
		<link>http://www.itauthor.com/2004/04/14/using-rcp-and-cron-to-perform-a-scheduled-network-backup/</link>
		<comments>http://www.itauthor.com/2004/04/14/using-rcp-and-cron-to-perform-a-scheduled-network-backup/#comments</comments>
		<pubDate>Wed, 14 Apr 2004 13:10:57 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=65</guid>
		<description><![CDATA[I recently set up a cron job on my PC to backup files from the PC to a network server every night. The technique uses SFU on the PC, rcp to copy the files to the network and cron to perform the backup at 3.15 every morning. For a full description, see: www.itauthor.com/unix_linux_shell/shell-backup-script.html]]></description>
			<content:encoded><![CDATA[<p>I recently set up a cron job on my PC to backup files from the PC to a network server every night. The technique uses SFU on the PC, rcp to copy the files to the network and cron to perform the backup at 3.15 every morning.</p>
<p>For a full description, see:</p>
<p><a href="http://www.itauthor.com/unix_linux_shell/shell-backup-script.html">www.itauthor.com/unix_linux_shell/shell-backup-script.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2004/04/14/using-rcp-and-cron-to-perform-a-scheduled-network-backup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grepping ls output</title>
		<link>http://www.itauthor.com/2004/04/14/grepping-ls-output/</link>
		<comments>http://www.itauthor.com/2004/04/14/grepping-ls-output/#comments</comments>
		<pubDate>Wed, 14 Apr 2004 08:42:49 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=64</guid>
		<description><![CDATA[grep is a useful tool for modifying the output from ls (the UNIX directory listing command). For example, if you want to list only the files beginning with a full stop ("."), you can use the command: ls -a &#124; grep '^\.' Note: if you're going to be using \ or * you need to [...]]]></description>
			<content:encoded><![CDATA[<p>grep is a useful tool for modifying the output from ls (the UNIX directory listing command).</p>
<p>For example, if you want to list only the files beginning with a full stop ("."), you can use the command:</p>
<p><b>ls -a | grep '^\.'</b></p>
<p><b>Note</b>: if you're going to be using <b>\</b> or <b>*</b> you need to enclose the expression that you pass to grep in single quotes.</p>
<p>I frequently want to list just the directories within the current directory. This is especially useful in a directory with lots of files. To do this I use the command:</p>
<p><b>ls -l | grep ^d</b></p>
<p>Which produces something like:</p>
<div>
<pre>drwxr-sr-x   2 me    mygroup   512 Mar  1  2002 News
drwx--S---   2 me    mygroup   512 Dec  8 12:42 Trash
drwxr-sr-x   3 me    mygroup   512 Jan  9 15:59 cvs
drwxrwsrwx   7 me    mygroup   512 Apr 14 00:28 documents-archive
drwx------   2 me    mygroup   512 Aug  4  2003 downloaded-files
drwx------   2 me    mygroup   512 Sep 18  2002 mail
drwxr-sr-x   3 me    mygroup   512 Feb 11 23:03 perlprogs
drwxrwsrwx   2 me    mygroup   512 Apr 13 23:44 temp
drwx------   2 me    mygroup   512 Aug 28  2003 upload-from-here</pre>
</div>
<p></p>
<p>If you're only interested in the directory names use:</p>
<p><b>ls -l | grep ^d | awk '{print $9}'</b></p>
<p>Which prints only column 9, giving you:</p>
<div>
<pre>News
Trash
cvs
documents-archive
downloaded-files
mail
perlprogs
temp
upload-from-here</pre>
</div>
<p><span id="more-64"></span><br />
<br />For more information on <b>awk</b>, see:</p>
<p><a href="http://www.linuxfocus.org/English/September1999/article103.html">http://www.linuxfocus.org/English/September1999/article103.html</a></p>
<p><a href="http://tille.soti.org/training/awk.php">http://tille.soti.org/training/awk.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2004/04/14/grepping-ls-output/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find an IP address given a host name</title>
		<link>http://www.itauthor.com/2004/04/07/find-an-ip-address-given-a-host-name/</link>
		<comments>http://www.itauthor.com/2004/04/07/find-an-ip-address-given-a-host-name/#comments</comments>
		<pubDate>Wed, 07 Apr 2004 15:50:49 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=63</guid>
		<description><![CDATA[Question: I'm logged in to a UNIX machine. How do I find out the IP address of a computer on the local network if I only have its host name? Answer: The easiest way is to use the command: ping hostname This will normally return something like: PING humphrey (192.168.1.100) 56(84) bytes of data. 64 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Question</strong>:<br />
I'm logged in to a UNIX machine. How do I find out the IP address of a computer on the local network if I only have its host name?</p>
<p><strong>Answer</strong>:<br />
The easiest way is to use the command:<br />
<strong>ping <i>hostname</i></strong></p>
<p>This will normally return something like:<br />
<strong>PING humphrey (192.168.1.100) 56(84) bytes of data.<br />
64 bytes from humphrey(192.168.1.100): icmp_seq=0 ttl=64 time=0.088 ms<br />
64 bytes from humphrey(192.168.1.100): icmp_seq=1 ttl=64 time=0.081 ms<br />
64 bytes from humphrey(192.168.1.100): icmp_seq=2 ttl=64 time=0.086 ms<br />
64 bytes from humphrey(192.168.1.100): icmp_seq=3 ttl=64 time=0.084 ms</strong></p>
<p>and you press <strong>Ctrl</strong>+<strong>C</strong> to stop the process.</p>
<p>However, sometimes ping will be set up so that it isn't so informative. It may just reply:<br />
<strong>humphrey is alive</strong></p>
<p>in which case you have a couple of alternatives.</p>
<p>If you want to find the IP address of the current UNIX machine you can use the command:<br />
<strong>cat /etc/hosts | grep `hostname` | awk '{print $1}'</strong></p>
<p>Note that the first quote marks are backticks (you can replace `hostname` with the host name of the current machine if you prefer, but this makes the command less portable), and the second set of quote marks are normal, straight, single quotes.</p>
<p>If this doesn't work it's probably because you aren't allowed to see the contents of /etc/hosts, but most system administrators trust their firewall enough to leave this file readable by domain users.</p>
<p>If you want to find out the IP address of another machine on the network, try:<br />
<strong>ypcat hosts | grep <i>hostname</i></strong></p>
<p><em>See also:<br />
<a href="http://www.itauthor.com/notes/archives/2005/11/find_a_host_nam.html">Find a host name given an IP address</a></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2004/04/07/find-an-ip-address-given-a-host-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redirecting standard error</title>
		<link>http://www.itauthor.com/2004/02/11/redirecting-standard-error/</link>
		<comments>http://www.itauthor.com/2004/02/11/redirecting-standard-error/#comments</comments>
		<pubDate>Wed, 11 Feb 2004 23:22:14 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=59</guid>
		<description><![CDATA[How to redirect standard error.]]></description>
			<content:encoded><![CDATA[<p>My previous posting made me think that I should probably note down something about redirecting standard output and standard error. This can be very useful, now and again, but rarely enough to make it easy to forget how it's done.</p>
<p>Redirection of standard output is easy:<br />
&gt; in most cases<br />
&lt; to go the other way<br />
&gt;&gt; or &lt;&lt; to append.</p>
<p>Redirecting standard error is the one I tend to forget.</p>
<p>In the C shell you can use the following to redirect standard error:</p>
<p>(command) &gt;&amp; file</p>
<p>For example:</p>
<p>(tar cvf tarfile.tar myprogramdirectory) &gt;&amp; log.txt</p>
<p>This tars up a directory and sends the verbose output to the log.txt file,<br />
rather than the screen, so that you can peruse it later.</p>
<p>You can redirect standard output and standard error independently like so:</p>
<p>(command &gt; outputfile) &gt;&amp; errorfile</p>
<p>For example:</p>
<p>(ls mydirectory &gt; directorylisting.txt) &gt;&amp; ls_error.txt</p>
<p>This sends a directory listing to a text file.<br />
If there's an error (e.g. there's no such directory)<br />
the error message gets put in the ls_error.txt file.</p>
<p>In bash (and most other shells), you use 2&gt; to redirect standard error.<br />
So the bash version of the previous example is:</p>
<p>(ls mydirectory &gt; directorylisting.txt) 2&gt; ls_error.txt</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2004/02/11/redirecting-standard-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>zip &#8216;n&#8217; tar</title>
		<link>http://www.itauthor.com/2004/02/11/zip-n-tar/</link>
		<comments>http://www.itauthor.com/2004/02/11/zip-n-tar/#comments</comments>
		<pubDate>Wed, 11 Feb 2004 23:17:29 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=58</guid>
		<description><![CDATA[A little reminder (because I hadn't done it for a while and had to look it up) of how to tar and zip and unzip and untar files.]]></description>
			<content:encoded><![CDATA[<p>A little reminder (because I hadn't done it for a while and had to look it up) of how to tar and zip and unzip and untar files.</p>
<p>First up, a recap on tarring and zipping.<br />
Tarring pulls a directory full of files and subdirectories together into a single file. Zipping a file compresses it.</p>
<p>&gt; To tar a directory use the command:</p>
<p><b>tar cvf destinationfile.tar directory</b></p>
<p>This creates a file called <b>destinationfile.tar</b> containing the entire contents of the directory called <b>directory </b>(including any subdirectories). The <b>c</b> flag means create (rather than append to an existing file). The <b>v</b> flag means use verbose mode (i.e. print a notification of each file that is tarred). The <b>f </b>flag means you're going to specify the name of the tar file rather than using the value of the TAPE environment variable or the default value defined in /<b>etc/default/tar</b>. </p>
<p>The verbose details get printed to standard error, which is the screen by default. You can redirect standard error to a file if you want to capture the output. This is a good idea if you are tarring a lot of files, otherwise the details of any problems appear briefly on the screen before being replaced by more information. If you capture the verbose details you can check what happened when the process completes. To capture the verbose details for the previous example:</p>
<p>In the C shell:</p>
<p><b>(tar cvf destinationfile.tar directory) &gt;&amp; log.txt</b></p>
<p>In bash:</p>
<p><b>(tar cvf destinationfile.tar directory) 2&gt; log.txt</b></p>
<p>&gt; Once you've got your tar file, nine times out of ten you're going to want to zip it.</p>
<p>To zip the tar file, use gzip:</p>
<p><b>gzip destinationfile.tar</b></p>
<p>This replaces <b>destinationfile.tar </b>with a compressed file called <b>destinationfile.tar.gz</b>. If you want to keep the original tar file, take a copy of it before zipping it.</p>
<p>&gt; To unzip a file zipped with gzip, use gunzip:</p>
<p><b>gunzip destinationfile.tar.gz</b></p>
<p>As you'd expect, this replaces destinationfile.tar.gz with a decompressed file called <b>destinationfile.tar</b>.</p>
<p>&gt; To untar your tar file:</p>
<p><b>tar xvf destinationfile.tar</b></p>
<p>This unpacks the tar file, recreating the original tarred directory as a subdirectory of the current directory. If a directory of the same name already exists the files from the tar file are added to it, overwriting any files of the same name. Existing files with different names are not removed. The tar file is not deleted.</p>
<p>&gt; If you want to see what's in a tar file, without going to the lengths of untarring it, use the command:</p>
<p><b>tar tvf tarfile.tar</b></p>
<p>The <b>t </b>flag lists the table of contents for the file. If you want to check whether the tar file contains a file called <b>myfile.fm</b>, you can use the command:</p>
<p><b>tar tf tarfile.tar *myfile.fm</b></p>
<p>If you want to check for files called <b>alsfile.txt</b>, <b>alistairsfile.fm</b>, <b>bobsfile.doc</b>, etc. you could use the command:</p>
<p><b>tar tvf tmp.tar | grep .*sfile\....</b></p>
<p>The <b>\.</b> is the dot character. The final three dots is the regexp way of saying any three characters.</p>
<p>Using this method, you can untar selected files. For example, to untar just files whose names end <b>.fm</b> use the command:</p>
<p><b>tar xvf tarfile.tar `tar tf tarfile.tar | grep \.fm$`</b></p>
<p>In this command the dollar sign is the regexp way of denoting the end of a line.<br />
This command would unpack all the <b>.fm</b> files, recreating the directory structure in which they originally lived. </p>
<p>If you are untarring a single file and you don't want to recreate all the directories that originally housed it, but you just want the file to be unpacked into the current directory, you can use the following syntax:</p>
<p><b>tar xvfO tarfile.tar *myfile.txt &gt; myfile.txt</b></p>
<p>The <b>O</b> flag (that's a capital "oh") isn't documented in the man page, but I just tried it and it had the desired effect. It sends the output of the process to standard output, which allows you to redirect it to a file.           </p>
<p>However, beware! If you use a command such as:</p>
<p><b>tar xvfO tarfile.tar `tar tf tarfile.tar | grep .*file\.txt$` &gt; myfile.txt</b></p>
<p>you are asking for trouble, because more than one file may be matched by grep and unpacked by tar, and the contents of all of the unpacked files will end up in the specified output file (<b>myfile.txt</b> in this case).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2004/02/11/zip-n-tar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SFU 3.5</title>
		<link>http://www.itauthor.com/2004/01/14/sfu-35/</link>
		<comments>http://www.itauthor.com/2004/01/14/sfu-35/#comments</comments>
		<pubDate>Wed, 14 Jan 2004 22:06:32 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=44</guid>
		<description><![CDATA[Microsoft's decision to give away the new release of its Services for UNIX subsystem is good news for those of us whose software runs on it. SFU 3 is a nice collection of software. But will SFU 3.5 run on Windows XP Home?]]></description>
			<content:encoded><![CDATA[<p>Today's big news (for those of us it affects) is Microsoft's decision to give away the new release of Services for UNIX. SFU 3.5 will be released by the end of this week, apparently, and will be available as a free download.</p>
<p>See <a href="http://www.informationweek.com/story/showArticle.jhtml?articleID=17300643">www.informationweek.com/story/showArticle.jhtml?articleID=17300643</a> for the full story.</p>
<p>The company I work for uses SFU to provide its server-side software on Windows servers. The code was originally written to run on UNIX (most of it tailored for Solaris) but SFU provides and easyish way to port to Windows.</p>
<p>Personally I like SFU. It's a big improvement on its predecessor (Interix), and it works pretty well. It allows you to have something very like UNIX running on your Windows machine, without having to dual boot or run VMware, and in my experience it's much easier to install and maintain than cygwin.</p>
<p>So I'm very pleased that 3.5 will be free. <i>However</i>, my main SFU gripe is that you can't install it on XP Home, which is what I have on my main home PC. It will only install on Professional &ndash; either Windows 2000 or XP. This means when I'm working from home I have to use my Win2k laptop as the server and my main desktop as a client. My Dell Latitude takes ages to boot up, so this setup can be a pain. Will 3.5 run on XP Home? Guffaw, guffaw!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2004/01/14/sfu-35/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UNIX date of death</title>
		<link>http://www.itauthor.com/2003/11/24/unix-date-of-death/</link>
		<comments>http://www.itauthor.com/2003/11/24/unix-date-of-death/#comments</comments>
		<pubDate>Mon, 24 Nov 2003 14:01:01 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=22</guid>
		<description><![CDATA[Links to the UNIX date stamp calculator and a basic intro to writing XML.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.unixtimestamp.com/index.php">timestamp.com</a> is a useful site if you need to calculate the UNIX time stamp for a particular date. There's a downloadable program is this is something you want to be able to do offline.</p>
<p>The site also includes a paragraph headed <b>What happens on July 8, 2038?</b>, which describes the UNIX date of death, when 32-bit processors run out of numbers for date stamps.</p>
<p>Another site I came across that might be useful if you're looking for a quick and basic introduction to XML is <a href="http://www.softwareag.com/xml/about/XML_in_Minutes.htm">Learn XML in 11.5 minutes</a>.</p>
<p>I spent some time over the weekend starting to design the home page for <a href="http://www.itauthor.com/index.html">this website</a>. Lots more to do, so I haven't uploaded anything yet, but it should be ready before too much longer.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2003/11/24/unix-date-of-death/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Replacing in vi</title>
		<link>http://www.itauthor.com/2003/11/21/replacing-in-vi/</link>
		<comments>http://www.itauthor.com/2003/11/21/replacing-in-vi/#comments</comments>
		<pubDate>Fri, 21 Nov 2003 09:13:18 +0000</pubDate>
		<dc:creator>alistair at home</dc:creator>
				<category><![CDATA[UNIX/Linux]]></category>

		<guid isPermaLink="false">http://www.itauthor.com/wordpress/?p=18</guid>
		<description><![CDATA[How to replace text in a file, using the vi editor.]]></description>
			<content:encoded><![CDATA[<p><b><a href="http://www.ibiblio.org/gferg/ldp/practical_linux_guide/">Practical Linux Guide</a> - Using vi</b></p>
<p><b>5.3. Search &amp; Replace</b><br />
To search for a regular expression (see section Regular Expressions) press slash, type the pattern and then start search with the enter key. vi jumps to the first occurrence of the specified pattern. To go to the next occurrence, press 'n'. </p>
<p>Replacing is done using the ':s' command. Type ':s/pattern/replacement/g' to replace all occurrences of pattern with replacement in the current line.<br />
Most of the time you want to work with the whole file, though. That is done using the ':%s' command. Use ':%s/pattern/replacement/g' and pattern is changed to replacement in the whole file. If you aren't sure whether you really want to replace all occurrences, you can append the character `c' at the end of the line. This stops at every occurrence of the pattern and asks if you really want to replace. </p>
<p>Source: <a href="http://www.ibiblio.org/gferg/ldp/practical_linux_guide/x360.html">http://www.ibiblio.org/gferg/ldp/practical_linux_guide/x360.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.itauthor.com/2003/11/21/replacing-in-vi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

