<?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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>The Developer&#039;s Tidbit</title>
	<atom:link href="http://ipggi.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ipggi.wordpress.com</link>
	<description>Helpful tips for random problems</description>
	<lastBuildDate>Wed, 15 May 2013 04:33:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='ipggi.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>The Developer&#039;s Tidbit</title>
		<link>http://ipggi.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ipggi.wordpress.com/osd.xml" title="The Developer&#039;s Tidbit" />
	<atom:link rel='hub' href='http://ipggi.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Run DOS on the Raspberry Pi &#8211; Use rpix86 to turn your Pi into a 1980s super-computer.</title>
		<link>http://ipggi.wordpress.com/2013/04/23/run-dos-on-the-raspberry-pi-use-rpix86-to-turn-your-pi-into-a-1980s-super-computer/</link>
		<comments>http://ipggi.wordpress.com/2013/04/23/run-dos-on-the-raspberry-pi-use-rpix86-to-turn-your-pi-into-a-1980s-super-computer/#comments</comments>
		<pubDate>Tue, 23 Apr 2013 09:00:09 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[rpix86]]></category>
		<category><![CDATA[Digital Research]]></category>
		<category><![CDATA[dos]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Microsoft Windows]]></category>
		<category><![CDATA[Seattle Computer Products]]></category>
		<category><![CDATA[X86]]></category>

		<guid isPermaLink="false">http://ipggi.wordpress.com/?p=1023</guid>
		<description><![CDATA[Please feel free to jump straight to the &#8216;DOS on the Pi&#8216; if you have no interest in a computer history lesson. What is DOS? DOS was a semi-open standard that included a common operating system for desktop computers in the 1980s and early 1990s. The hardware used Intel x86-compatible CPUs while the operating system [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=1023&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Please feel free to jump straight to the &#8216;<a href="#dosonthepi">DOS on the Pi</a>&#8216; if you have no interest in a computer history lesson.</p>
<h2>What is DOS?</h2>
<p>DOS was a semi-open standard that included a common operating system for desktop computers in the 1980s and early 1990s. The hardware used <a href="http://en.wikipedia.org/wiki/X86">Intel x86-compatible CPUs</a> while the operating system for this architecture was <a href="http://en.wikipedia.org/wiki/DOS">DOS the Disk Operating System</a>. Note that the DOS acronym was also used for a number of incompatible and unrelated computer systems such the <a href="http://en.wikipedia.org/wiki/Apple_DOS">Apple DOS</a> and <a href="http://en.wikipedia.org/wiki/Atari_DOS">Atari DOS</a>.</p>
<p>As DOS was a primitive, text only operating system that was easy to reverse-engineer. A number of companies made their own editions of DOS and for the most part they were all compatible with each other. The most common x86-edition of DOS was <a href="http://en.wikipedia.org/wiki/Microsoft">Microsoft</a>&#8216;s <a href="http://en.wikipedia.org/wiki/MS-DOS">MS-DOS</a> but <a href="http://en.wikipedia.org/wiki/Ibm">IBM</a> also had their own <a href="http://en.wikipedia.org/wiki/PC-DOS">PC-DOS</a> as did <a href="http://en.wikipedia.org/wiki/Digital_Research">Digital Research</a> with <a href="http://en.wikipedia.org/wiki/DR-DOS">DR-DOS</a>.</p>
<p>MS-DOS was Microsoft&#8217;s precursor to its Windows operating system. In the 1990s many editions of Windows were simply a layer of software designed to load up after MS-DOS or later contained MS-DOS built-in.</p>
<p>Off the shelf x86-compatible hardware combined with the DOS operating system became the prominent computer gaming system in North America from the late 1980s until <a href="http://en.wikipedia.org/wiki/Windows_95">Windows 95</a>. Other regions such as Europe preferred cheaper, propriety systems such as the 8-bit <a href="http://en.wikipedia.org/wiki/Commodore_64">Commodore 64</a>, <a href="http://en.wikipedia.org/wiki/Amstrad_CPC">Amstrad CPC</a>, <a href="http://en.wikipedia.org/wiki/Sinclair_ZX_Spectrum">Sinclair Spectrum</a>. Or the equally as expensive but more user-friendly 16-bit <a href="http://en.wikipedia.org/wiki/Atari_ST">Atari ST</a> and <a href="http://en.wikipedia.org/wiki/Commodore_Amiga">Commodore Amiga</a> lines. In these parts of the world x86-compatible computers only became popular after the early 1990s.</p>
<h2>How did DOS come to be?</h2>
<p>DOS started out as a clone of the early microcomputer operating system <a href="http://en.wikipedia.org/wiki/CP/M">CP/M</a> by Digital Research. CP/M was created in 1973 to run on the <a href="http://www.computinghistory.org.uk/det/3366/Intellec-8/">Intel Intellec-8</a> development system which happen to be the first microcomputer sold in the USA.</p>
<p>By the end of the 1970&#8242;s CP/M was the most popular microcomputer operating system for professionals and business. Once IBM decided to enter this burgeoning market they wanted to use CP/M on their future products but they couldn&#8217;t come to an amicable agreement with Digital Research.</p>
<p>So IBM asked Microsoft to develop a clone of CP/M for their first microcomputer that they dubbed the Personal Computer or the PC. But at this early stage of its life Microsoft had never developed an operating system but bluffed IBM to believe otherwise.</p>
<p>Microsoft discovered a small software company known as <a href="http://en.wikipedia.org/wiki/Seattle_Computer_Products">Seattle Computer Products</a> who had a x86-compatible CP/M clone called <a href="http://en.wikipedia.org/wiki/86-DOS">86-DOS</a>. Microsoft signed a non-exclusive contract to market and distribute this operating system and on-sold it to IBM. Just weeks before IBM&#8217;s major PC public announcement Microsoft obtained near-exclusive rights for Seattle&#8217;s 86-DOS.</p>
<p>In August of 1981 IBM launched the <a href="http://en.wikipedia.org/wiki/IBM_PC">IBM PC</a>. A machine that bought mainstream attention to microcomputers and made them respectable in the eyes of the public. Every IBM PC sold was operating off a royalty-free copy of Seattle Computer Products 86-DOS operating system re-branded as PC-DOS.</p>
<p>IBM had always been a hardware company and believed there was little money in software. <a href="http://en.wikipedia.org/wiki/Apple_Inc.">Apple</a> to this day follows that same ethos. What IBM failed to realise was they had designed their machine with off the shelf parts that anyone could buy. The only thing other manufactures lacked to create their own PCs was the operating system. But due to IBM&#8217;s non-exclusive operating system agreement. Microsoft was free to re-brand their own version of IBM&#8217;s PC-DOS and to sell it to potential companies who wanted to make copycat IBM PCs. That small mistake by IBM launched Microsoft, who became one of the world&#8217;s largest companies.</p>
<h2>Why DOS?</h2>
<p>Many popular franchises, genres and software companies were first launched or popularised on DOS. Warcraft, Grand Theft Auto, Sid Meier&#8217;s Civilization, Monkey Island, X-Com, Need for Speed. The first person shooter, the graphic adventure, simulators, real-time strategy are some examples. So DOS would be well worth investigating for anyone who has an interest in retro-gaming from this era.</p>
<h2>Why not DOS?</h2>
<p>It must be said that the DOS ecosystem has to be the most complicated and arcane mainstream gaming system of all time. The same openness that made it popular was also what made it so horrible to use.</p>
<p>Backwards compatibility was a major benefit and selling point of the DOS ecosystem. But at the same time it held it back and made it much more complicated than necessary. By the late 1980s, its text based 1970s lineage was horribly primitive and outdated.</p>
<p>Hardware support was complex. Often users had to manually change and configure their operating system for each item of software they ran. What unfortunately started off as a simple and clean system for IBM in 1981 evolved into an ad hoc open platform that it was never designed for.</p>
<p>Worse was hardware driver support. For the most part new hardware had to be directly supported by software. This meant that a user&#8217;s existing game collection would often not support new hardware simply because it didn&#8217;t exist when the software was written.</p>
<p>Finally many game developers targeted the lowest common denominator hardware. This meant you could have had the latest and most expensive hardware yet it could have been ignored by new release software that was designed for a machine that was 5+ years old.</p>
<p>Fortunately much of this hardware complexity is now avoided when using software emulation such as <a href="http://rpix86.patrickaalto.com/">rpix86 on the Raspberry Pi</a>.</p>
<div class="wp-caption alignleft" style="width: 330px"><a href="http://www.mobygames.com/game/dos/snooper-troops"><img alt="" src="http://www.mobygames.com/images/shots/l/170148-snooper-troops-dos-screenshot-title-screens.png" width="320" height="200" /></a><p class="wp-caption-text">Snooper Troops supporting IBM&#8217;s Color Graphics Adapter  in 1982.</p></div>
<div class="wp-caption alignleft" style="width: 330px"><a href="http://www.mobygames.com/game/pc-booter/trolls-tale"><img class=" " alt="" src="http://www.mobygames.com/images/shots/l/148246-troll-s-tale-pc-booter-screenshot-hmm-some-huts-to-explore.png" width="320" height="200" /></a><p class="wp-caption-text">1984&#8242;s Troll&#8217;s Tale on IBM&#8217;s PCJr.</p></div>
<div class="wp-caption alignleft" style="width: 330px"><a href="http://www.mobygames.com/game/dos/kings-quest-iii-to-heir-is-human"><img alt="" src="http://www.mobygames.com/images/shots/l/16057-king-s-quest-iii-to-heir-is-human-dos-screenshot-seaside-towns.gif" width="320" height="200" /></a><p class="wp-caption-text">IBM&#8217;s Enhanced Graphics Adapter in use in 1986&#8242;s King&#8217;s Quest III.</p></div>
<div class="wp-caption alignleft" style="width: 330px"><a href="http://www.mobygames.com/game/dos/moebius-the-orb-of-celestial-harmony"><img class=" " alt="" src="http://www.mobygames.com/images/shots/l/17905-moebius-the-orb-of-celestial-harmony-dos-screenshot-starting.gif" width="320" height="200" /></a><p class="wp-caption-text">IBM&#8217;s Multicolor Graphics Array in 1987 allowed photo like graphics in Moebius: The Orb of Celestial Harmony.</p></div>
<div class="wp-caption alignleft" style="width: 330px"><a href="http://www.mobygames.com/game/dos/kings-quest-v-absence-makes-the-heart-go-yonder"><img alt="" src="http://www.mobygames.com/images/shots/l/2085-king-s-quest-v-absence-makes-the-heart-go-yonder-dos-screenshot.gif" width="320" height="200" /></a><p class="wp-caption-text">King&#8217;s Quest V from 1990 was one of the first titles to fully embrace IBM&#8217;s Video Graphics Array with upto 256 colours on-screen.</p></div>
<div class="wp-caption alignleft" style="width: 330px"><a href="http://www.mobygames.com/game/dos/links-386-pro"><img class=" " alt="" src="http://www.mobygames.com/images/shots/l/14368-links-386-pro-dos-screenshot-harbour-town-on-the-green-hole.gif" width="320" height="200" /></a><p class="wp-caption-text">By 1992 some games such as Links 386 Pro had embraced hi-resolution Super VGA graphics.</p></div>
<h2 style="clear:both;">DOS today?</h2>
<p>DOS is still used on embedded systems that need a simple and small, text only operating system. Today most of the DOS community centres around the open source <a href="http://www.freedos.org/">FreeDOS</a> that offers modern tools as well as legacy compatibility.<br />
<a id="dosonthepi"></a></p>
<h1>DOS on the Pi.</h1>
<p>At the time of writing in April 2013 the only acceptable DOS emulator for the Raspberry Pi is rpix86 by Patrick Aalto found at <a href="http://rpix86.patrickaalto.com/">http://rpix86.patrickaalto.com</a>.</p>
<h2>What PC hardware does rpix86 emulate?</h2>
<blockquote><p>CPU: 80486 processor, including the protected mode features (for running DOS4GW games) but without virtual memory support. The emulation runs at a speed of around 20MHz 80486 (which equals a 40MHz 80386) machine.<br />
Memory: 640KB of low memory, 4MB of EMS memory and 16MB of XMS memory.<br />
Super-VGA graphics, with a maximum resolution of 640&#215;480 with 256 colors.<br />
SoundBlaster 2.0 (including AdLib-compatible FM sounds) sound card.</p></blockquote>
<p>This combined hardware could have belonged to a very expensive high-end PC in the very late 1980s. Or a more affordable and common mid-range PC in the early 1990s. In that later era the audio would have been the machine&#8217;s weakest point. The graphics and memory would have been very good while the CPU would have been average.</p>
<p>My article <a href="http://ipggi.wordpress.com/2008/04/26/dosbox-sound-emulation/">DOSBox Sound Emulation</a> talks about the huge variety of audio options on the x86-compatible platform while <a href="http://ipggi.wordpress.com/2008/03/16/dosbox-graphic-and-machine-emulation-cga-vga-tandy-pcjr-hercules/">DOSBox Graphic and Machine Emulation</a> covers the variety of graphic modes.</p>
<h2>What operating systems does rpix86 support?</h2>
<p>Unfortunately only the obscure 4DOS is supported by rpix86. 4DOS is a rather full featured and complex edition of DOS created by a small company out of Germany. While it was great for daily users of DOS based PCs back in the 1990s. It is an overkill for our purposes of PC gaming emulation on the Pi.</p>
<p>4DOS downloads <a href="http://www.4dos.info/v4dos.htm">http://www.4dos.info/v4dos.htm</a></p>
<h2>Raspberry Pi set up.</h2>
<p>This guide assumes that a clean install of Raspbian is in use on the Raspberry Pi.</p>
<p>Raspbian can be obtained from <a href="http://www.raspberrypi.org/downloads">http://www.raspberrypi.org/downloads</a><br />
A guide for installing Raspbian to an SD card for use with the Raspberry Pi is at <a href="http://elinux.org/RPi_Easy_SD_Card_Setup">http://elinux.org/RPi_Easy_SD_Card_Setup</a></p>
<div id="attachment_1087" class="wp-caption alignnone" style="width: 382px"><a href="http://ipggi.files.wordpress.com/2013/04/raspi-config.png"><img class=" wp-image-1087  " alt="raspi-config" src="http://ipggi.files.wordpress.com/2013/04/raspi-config.png?w=372&#038;h=159" width="372" height="159" /></a><p class="wp-caption-text">raspi-config.</p></div>
<p>Start your Raspberry Pi with a new install of Raspbian and at the Raspbian <em>Raspi-config</em> configuration tool do the following.</p>
<p>First select <em>update</em> to make sure you&#8217;re using the latest version of the configuration tool.<br />
Select <em>expand_rootfs</em> so the free space on the SD card is fully utilised.<br />
Select <em>change_timeszone</em> to set your Pi&#8217;s time zone.<br />
Select <em>boot_behaviour</em> and set <em>Should we boot straight to desktop?</em> as <em>No</em>.<br />
Select <em>change_pass</em> to change the default pi user password.<br />
Select <em>&lt;Finish&gt;</em> to exit.</p>
<p>Now in terminal if you ever need to return to <em>Raspi-config</em>.</p>
<p><code>sudo raspi-config</code></p>
<p>Now lets update Raspbian and any out-of-date software.</p>
<p><code>sudo apt-get upgrade -y</code></p>
<h2>DOS set up.</h2>
<p>We are going to use a directory called <code>/dos</code> located in our <em>pi</em> home directory <code>/home/pi/</code> to store our rpix86 related files. For the commands shown below <code>~/</code> in Linux is treated a short-cut for the <em>pi</em> user home directory.</p>
<p><code>mkdir ~/dos<br />
cd ~/dos</code></p>
<div id="attachment_1089" class="wp-caption alignnone" style="width: 258px"><a href="http://ipggi.files.wordpress.com/2013/04/mkdir-_dos.png"><img class="size-full wp-image-1089" alt="mkdir ~/dos" src="http://ipggi.files.wordpress.com/2013/04/mkdir-_dos.png?w=620"   /></a><p class="wp-caption-text">mkdir ~/dos</p></div>
<p>This <code>/dos</code> directory will also double up for a mock hard drive that rpix86 will use for DOS.</p>
<p>Download the latest version of rpix86 the DOS emulator.</p>
<p><code>wget <a href="http://rpix86.patrickaalto.com/rpix86.tar.gz" rel="nofollow">http://rpix86.patrickaalto.com/rpix86.tar.gz</a></code></p>
<div id="attachment_1090" class="wp-caption alignnone" style="width: 630px"><a href="http://ipggi.files.wordpress.com/2013/04/wget-rpix86-tar-gz.png"><img class="size-full wp-image-1090" alt="wget rpix86.tar.gz" src="http://ipggi.files.wordpress.com/2013/04/wget-rpix86-tar-gz.png?w=620&#038;h=155" width="620" height="155" /></a><p class="wp-caption-text">wget rpix86.tar.gz</p></div>
<p>Now uncompress and run rpix86. Please note that rpix86 will not work over a remote terminal connection such as SSH or Telnet.</p>
<p><code>tar -xf rpix86.tar.gz<br />
./rpix86</code></p>
<div id="attachment_1091" class="wp-caption alignnone" style="width: 630px"><a href="http://ipggi.files.wordpress.com/2013/04/rpix86.png"><img class="size-full wp-image-1091" alt="rpix86" src="http://ipggi.files.wordpress.com/2013/04/rpix86.png?w=620&#038;h=73" width="620" height="73" /></a><p class="wp-caption-text">rpix86 running under a remote terminal connection.</p></div>
<p>When prompted press <em>Y</em> to download the required <em>4DOS.COM command interpreter</em>.</p>
<div id="attachment_1092" class="wp-caption alignnone" style="width: 630px"><a href="http://ipggi.files.wordpress.com/2013/04/rpix86-unable-to-find-4dos-com.png"><img class="size-full wp-image-1092" alt="rpix86 unable to find 4dos.com" src="http://ipggi.files.wordpress.com/2013/04/rpix86-unable-to-find-4dos-com.png?w=620&#038;h=124" width="620" height="124" /></a><p class="wp-caption-text">rpix86 unable to find 4dos.com.</p></div>
<p>Once complete your Raspberry Pi should be running a DOS prompt.</p>
<div id="attachment_1093" class="wp-caption alignnone" style="width: 630px"><a href="http://ipggi.files.wordpress.com/2013/04/rpix86-startup.png"><img class="size-full wp-image-1093" alt="rpix86 startup" src="http://ipggi.files.wordpress.com/2013/04/rpix86-startup.png?w=620&#038;h=157" width="620" height="157" /></a><p class="wp-caption-text">rpix86 startup.</p></div>
<h2>Basics of DOS shell.</h2>
<p>At its core a DOS shell is essentially a self-contained program that allows commands to be run from a text prompt. It lets you interact with your computer&#8217;s file system and some hardware. By interacting with the file system you can launch programs; move, copy or delete files and modify the directories.</p>
<p>The rest of the DOS operating system comes in the form of extra programs, applications and hardware drivers that usually reside in a subdirectory. These additions can vary between different releases and iterations of DOS.</p>
<h3>DOS command prompt explained.</h3>
<p><strong><code>C:\&gt;</code></strong></p>
<p><strong><code>C:</code></strong> Is the active drive. In DOS each floppy, CD, DVD or hard drive is assigned its own drive letter. The <code>C:</code> drive is usually reserved for the first hard drive while <code>A:</code> and <code>B:</code> are reserved for floppy drives.<br />
<strong><code>\</code></strong> Is the active directory. When a backlash is displayed the active directory is at the root of the drive.<br />
<strong><code>&gt;</code></strong> Is the beginning of the text prompt.<br />
<strong><code>_</code></strong> Is a blinking prompt that shows where the user&#8217;s typed input will display.</p>
<h3>Commands.</h3>
<p>Please run the following commands in the DOS prompt. Note that unlike Linux, DOS  is not case sensitive.</p>
<p>List the current directory.</p>
<p><code>DIR</code></p>
<p>Display some basic 4DOS information.</p>
<p><code>4DOS</code></p>
<p>Clear the screen.</p>
<p><code>CLS</code></p>
<p>Make a new directory named <code>TEST</code>.</p>
<p><code>MKDIR TEST</code></p>
<p>Copy the file 4DOS.COM to the <code>TEST </code>directory.</p>
<p><code>COPY 4DOS.COM TEST</code></p>
<p>List the content of the <code>TEST </code>directory.</p>
<p><code>DIR TEST</code></p>
<p>Change the active directory to <code>TEST</code>.</p>
<p><code>CD TEST</code></p>
<p>Delete the file <code>4DOS.COM</code></p>
<p><code>DEL 4DOS.COM</code></p>
<p>Change the active directory to root.</p>
<p><code>CD\</code></p>
<p>Remove the directory <code>TEST</code>.</p>
<p><code>RMDIR TEST</code></p>
<p>You can use the <code>[Tab]</code> key to auto-complete the names of files and directories that exist in the active directory.</p>
<p><code>4d [Tab]</code></p>
<p>You can cycle through previous commands typed at prompt by using the up and down arrow keys.</p>
<p>Quit rpix86.</p>
<p><code>EXIT</code></p>
<div id="attachment_1100" class="wp-caption alignnone" style="width: 136px"><a href="http://ipggi.files.wordpress.com/2013/04/dos-commands.png"><img class="size-thumbnail wp-image-1100" alt="DOS commands." src="http://ipggi.files.wordpress.com/2013/04/dos-commands.png?w=126&#038;h=150" width="126" height="150" /></a><p class="wp-caption-text">DOS commands.</p></div>
<h2>Dumb DOS names.</h2>
<p>DOS uses the FAT file system. The legacy <a href="http://en.wikipedia.org/wiki/Fat16">FAT16</a> file system was first introduced into MS-DOS 4.0 and used through the late 1980s and early 1990s. It is horribly dated but can still be read by modern operating systems.</p>
<p>Because of its age FAT and DOS has a number of particular but important to know traits.</p>
<ul>
<li>In DOS file and directory names can be at most 8 characters long. An additional identifier extension can be given but that can only be up to 4 characters and the first character must always be a period.</li>
<li>File usage is identified by extensions, many of which are still in use today. <code>FILE.TXT</code> is a plain text document. <code>FILE.MP3</code> is an MP3 audio track. <code>FILE.AVI</code> is a video file. <code>FILE.HTM</code> is a HTML document. DOS script files use the <code>.BAT</code> (batch processing) file extension. Program files use <code>.EXE</code> (execute) or the <code>.COM</code> (command) file extensions.</li>
<li>Files and directories are case insensitive.</li>
<li>The backlash <strong><code>\</code></strong> character is used to separate directory and file paths.</li>
</ul>
<h2>Fetch and use DOS software.</h2>
<p>For the purposes of this article I will only use games sourced from the excellent <a href="http://www.dosgamesarchive.com">DOS Game Archive</a>. It only offers DOS software that is legal to distribute and use without payment.</p>
<p>Under the Copyright laws of many countries, copyright on software remains active until 50 or 70 years after an author&#8217;s death. This is designed to protect any potential long-term income and the resale value of a product.</p>
<p>The majority of dated, commercial computer software has no financial value and is usually long out of print. This is more apparent with software created for obsolete systems such as DOS. Copyright of this type is rarely defended by its owners and is unofficially known as <a href="http://en.wikipedia.org/wiki/Abandonware">abandonware</a>.</p>
<p>While the act the downloading and use of abandonware is classed as piracy and is officially illegal. I personally do not see any serious legal or moral issues with downloading and using out of print, obsolete commercial software. But you should use your own judgement.</p>
<h3>Where to get games?</h3>
<p>You can find legal to download DOS shareware, freeware and public domain games at the DOS Game Archive <a href="http://www.dosgamesarchive.com">http://www.dosgamesarchive.com</a>.</p>
<p>To find abandoned but technically illegal to download DOS software, type DOS abandonware into Google and go from there.</p>
<h3>DOS Demo 1 &#8211; LucasArts, Day of the Tentacle Demo</h3>
<p>The surreal and funny <a href="http://www.mobygames.com/game/maniac-mansion-day-of-the-tentacle">Day of the Tentacle</a> was a huge success for LucasArts in 1993. This non-interactive demonstration is easy to run and shows the old DOS low resolution VGA graphics and SoundBlaster audio hardware at its best.</p>
<p>At the Raspbian Linux terminal prompt create the directory <code>DOTTDEMO</code>.</p>
<p><code>mkdir ~/dos/DOTTDEMO</code></p>
<p>Change the active directory to <code>DOTTDEMO</code>.</p>
<p><code>cd ~/dos/DOTTDEMO</code></p>
<p>Use <code>wget</code> to download the Day of the Tentacle demo from <a href="http://www.dosgamesarchive.com/download/maniac-mansion-day-of-the-tentacle/">DOS Game Archive</a>.</p>
<p><code>wget ftp://download.dosgamesarchive.com/tentacle.zip</code></p>
<p>Uncompress the demo file using <code>unzip</code>.</p>
<p><code>unzip tentacle.zip</code></p>
<p>Return back to the <code>/dos</code> directory and run rpix86.</p>
<p><code>cd ..<br />
./rpix86</code></p>
<p>Now in the rpix86 DOS prompt list the content of the DOS root to make sure the <code>DOTTDEMO </code>directory exists.</p>
<p><code>DIR</code></p>
<p>Change the active directory to <code>DOTTDEMO</code>.</p>
<p><code>CD DOTTDEMO</code></p>
<p>List the content of <code>DOTTDEMO </code>but only display items that use the extension <code>.EXE</code> which are execute programs.</p>
<p><code>DIR *.EXE</code></p>
<p>Run the program <code>DOTTDEMO.EXE</code>.</p>
<p><code>DOTTDEMO.EXE</code></p>
<p>Congratulations, hopefully you have a working Day of the Tentacle demo.</p>
<p>To exit the demo press <code>[Alt] X</code> and follow the prompt.</p>
<div id="attachment_1102" class="wp-caption alignnone" style="width: 160px"><a href="http://ipggi.files.wordpress.com/2013/04/raspian-wget-dott.png"><img class="size-thumbnail wp-image-1102 " alt="wget DOTT" src="http://ipggi.files.wordpress.com/2013/04/raspian-wget-dott.png?w=150&#038;h=71" width="150" height="71" /></a><p class="wp-caption-text">wget tentacle.zip</p></div>
<div id="attachment_1105" class="wp-caption alignnone" style="width: 160px"><a href="http://ipggi.files.wordpress.com/2013/04/rpix86-dos-for-dott.png"><img class="size-thumbnail wp-image-1105" alt="DOS for DOTT" src="http://ipggi.files.wordpress.com/2013/04/rpix86-dos-for-dott.png?w=150&#038;h=93" width="150" height="93" /></a><p class="wp-caption-text">DOS for DOTT</p></div>
<div id="attachment_1101" class="wp-caption alignnone" style="width: 160px"><a href="http://ipggi.files.wordpress.com/2013/04/rpix86-dott-demo.png"><img class="size-thumbnail wp-image-1101 " alt="DOTT DEMO" src="http://ipggi.files.wordpress.com/2013/04/rpix86-dott-demo.png?w=150&#038;h=98" width="150" height="98" /></a><p class="wp-caption-text">DOTTDEMO.EXE</p></div>
<h3 style="clear:left;">DOS Demo 2 &#8211; Sierra Online, Space Quest 3.</h3>
<p>From early 1980s to the 1990s Sierra Online were all about pushing the envelopes of audio and visuals on the home computer. <a href="http://www.mobygames.com/game/space-quest-iii-the-pirates-of-pestulon">Space Quest 3</a> in early 1989 was certainly doing that on the PC. Unfortunately but common for the era, this demo requires a rather complex set-up procedure.</p>
<p>At the Raspbian Linux terminal prompt create the directory <code>SQ3DEMO</code>.</p>
<p><code>mkdir ~/dos/SQ3DEMO</code></p>
<p>Change the active directory to <code>SQ3DEMO</code>.</p>
<p><code>cd ~/dos/SQ3DEMO</code></p>
<p>Use <code>wget</code> to download the Space Quest 3 demo from <a href="http://www.dosgamesarchive.com/download/space-quest-iii-the-pirates-of-pestulon/">DOS Game Archive</a>.</p>
<p><code>wget ftp://download.dosgamesarchive.com/spaceq3.zip</code></p>
<p>Uncompress the demo file using <code>unzip</code>.</p>
<p><code>unzip spaceq3.zip</code></p>
<p>Return back to the <code>/dos</code> directory and run rpix86.</p>
<p><code>cd ..<br />
./rpix86<br />
</code><br />
Now in the rpix86 DOS prompt list the content of the DOS root to make sure the <code>SQ3DEMO</code> directory exists.</p>
<p><code>DIR</code></p>
<p>Change the active directory to <code>SQ3DEMO</code>.</p>
<p><code>CD SQ3DEMO</code></p>
<p>List the content of <code>SQ3DEMO </code>but only display items that use the extension <code>.EXE</code> which are execute programs.</p>
<p><code>DIR *.EXE</code></p>
<p>Run the program <code>INSTALL.EXE</code> to tell the demo of Space Quest 3 what hardware our DOS machine supports.</p>
<p><code>INSTALL.EXE</code></p>
<p>In the <em>Sierra Game Setup/Installation Program</em>.</p>
<p>Press <code>[Enter]</code> at the <em>Sierra&#8217;s newest products</em> .. notification.</p>
<p>Select <em>EGA/VGA with RGB monitor</em>.</p>
<p>Select <em>AdLib Music Synthesizer Card</em>.</p>
<p>Select <em>IBM or IBM-compatible keyboard</em>.</p>
<p>Press <code>[Enter]</code> at the <em>NUMLOCK is OFF</em> confirmation.</p>
<p>Select <em>NO</em> for the MicroSoft compatible mouse.</p>
<p>Press <code>[Esc]</code> to skip the install the game on your hard disk.</p>
<p>Press <code>[Enter]</code> at the <em>Installation is complete</em> prompt.</p>
<p>Back at the DOS prompt list the content of <code>SQ3DEMO</code> but only display items that use the extension <code>.BAT</code> which are script files. Many older Sierra games used batch script files to launch their programs.</p>
<p><code>DIR *.BAT</code></p>
<p>Run the batch script <code>SQ3DEMO.BAT</code> to launch the Space Quest 3 demo.</p>
<p><code>SQ3DEMO.BAT</code></p>
<p>Welcome to <em>Scenes From Space Quest III</em>.</p>
<p>To exit press <code>[Esc]</code> to bring up the in-game menu and then select <em>File</em> &gt; <em>Quit</em>.</p>
<div id="attachment_1107" class="wp-caption alignnone" style="width: 160px"><a href="http://ipggi.files.wordpress.com/2013/04/rpix86-sq3-demo.png"><img class="size-thumbnail wp-image-1107" alt="SQ3DEMO.BAT" src="http://ipggi.files.wordpress.com/2013/04/rpix86-sq3-demo.png?w=150&#038;h=93" width="150" height="93" /></a><p class="wp-caption-text">SQ3DEMO.BAT</p></div>
<h3>Demo 3 - Windmill Software Digger</h3>
<p>Next up is the rather simple <a href="http://www.mobygames.com/game/pc-booter/digger">Digger</a> created by Windmill Software in 1983. The basic graphics and primitive audio was amazing compared to many early games created for the original IBM PC machines of this era. This game looks to be inspired by the 1982 Universal arcade game Mr. Do! Currently there is some audio emulation issues with this game when used on rpix86.</p>
<p>At the Raspbian Linux terminal prompt create the directory <code>DIGGER</code>.</p>
<p><code>mkdir ~/dos/DIGGER</code></p>
<p>Change the active directory to <code>DIGGER</code>.</p>
<p><code>cd ~/dos/DIGGER</code></p>
<p>Use <code>wget</code> to download Digger from <a href="http://www.dosgamesarchive.com/download/digger/">DOS Game Archive</a>.</p>
<p><code>wget ftp://download.dosgamesarchive.com/digger.zip</code></p>
<p>Uncompress the game file using <code>unzip</code>.</p>
<p><code>unzip digger.zip</code></p>
<p>Return back to the <code>/dos</code> directory and run rpix86.</p>
<p><code>cd ..<br />
./rpix86</code></p>
<p>Now in the rpix86 DOS prompt list the content of the DOS root to make sure the <code>DIGGER </code>directory exists.</p>
<p><code>DIR</code></p>
<p>Change the active directory to <code>DIGGER</code>.</p>
<p><code>CD DIGGER</code></p>
<p>List the content of the directory <code>DIGGER</code>.</p>
<p><code>DIR</code></p>
<p>Run the program <code>DIGGER.EXE</code>.</p>
<p><code>DIGGER.EXE</code></p>
<p>Welcome to computer video gaming 1983 style. Use the arrow keys to control your character or to exit Digger press <code>[F10]</code> a couple of times.</p>
<div id="attachment_1108" class="wp-caption alignnone" style="width: 160px"><a href="http://ipggi.files.wordpress.com/2013/04/rpix86-digger.png"><img class="size-thumbnail wp-image-1108" alt="DIGGER.COM" src="http://ipggi.files.wordpress.com/2013/04/rpix86-digger.png?w=150&#038;h=93" width="150" height="93" /></a><p class="wp-caption-text">DIGGER.COM</p></div>
<h3>Demo 4 &#8211; Non-working Games</h3>
<p>At the moment rpix86 is still an immature product and your mileage for running various software will vary. Some DOS software can be temperamental such as Epic MegaGame&#8217;s <a href="http://www.mobygames.com/game/dos/zone-66">Zone 66</a> from 1993. It demands that we do not load any DOS XMS memory drivers but currently we can not do this in rpix86.</p>
<p>At the Raspbian Linux terminal prompt create the directory <code>ZONE66</code>.</p>
<p><code>mkdir ~/dos/ZONE66</code></p>
<p>Change the active directory to <code>ZONE66</code>.</p>
<p><code>cd ~/dos/ZONE66</code></p>
<p>Use wget to download Zone66 from <a href="http://www.dosgamesarchive.com/download/zone-66/">DOS Game Archive</a>.</p>
<p><code>wget ftp://download.dosgamesarchive.com/zone66.zip</code></p>
<p>Uncompress the game file using <code>unzip</code>.</p>
<p><code>unzip zone66.zip</code></p>
<p>Return back to the <code>/dos</code> directory and run rpix86.</p>
<p><code>cd ..<br />
./rpix86</code></p>
<p>Now in the rpix86 DOS prompt list the content of the DOS root to make sure the <code>ZONE66 </code>directory exists.</p>
<p><code>CD ZONE66</code></p>
<p>List the content of <code>ZONE66 </code>but only display items that use the extension <code>.EXE</code> which are execute programs.</p>
<p><code>DIR *.EXE</code></p>
<p>Run the program <code>ZONE66.EXE</code>.</p>
<p><code>ZONE66.EXE</code></p>
<div id="attachment_1109" class="wp-caption alignnone" style="width: 160px"><a href="http://ipggi.files.wordpress.com/2013/04/rpix86-zone66-abort.png"><img class="size-thumbnail wp-image-1109" alt="ZONE66.EXE" src="http://ipggi.files.wordpress.com/2013/04/rpix86-zone66-abort.png?w=150&#038;h=94" width="150" height="94" /></a><p class="wp-caption-text">ZONE66.EXE</p></div>
<p>Disappointingly we receive an abort error message <em>This program can not run with an XMS driver!!!</em> because our DOS operating system is not configured correctly. As you can see gaming on PCs in this era often required more technical knowledge than today.</p>
<h2>Fi</h2>
<p>Well that is it for this tutorial. I will continue to update this entry as new revisions of rpix86 are released for the Raspberry Pi. Feel free to ask any questions in the comments below.</p>
<br />Filed under: <a href='http://ipggi.wordpress.com/category/raspberry-pi/'>Raspberry Pi</a>, <a href='http://ipggi.wordpress.com/category/raspberry-pi/rpix86/'>rpix86</a> Tagged: <a href='http://ipggi.wordpress.com/tag/digital-research/'>Digital Research</a>, <a href='http://ipggi.wordpress.com/tag/dos/'>dos</a>, <a href='http://ipggi.wordpress.com/tag/ibm/'>IBM</a>, <a href='http://ipggi.wordpress.com/tag/microsoft/'>Microsoft</a>, <a href='http://ipggi.wordpress.com/tag/microsoft-windows/'>Microsoft Windows</a>, <a href='http://ipggi.wordpress.com/tag/raspberry-pi/'>Raspberry Pi</a>, <a href='http://ipggi.wordpress.com/tag/seattle-computer-products/'>Seattle Computer Products</a>, <a href='http://ipggi.wordpress.com/tag/x86/'>X86</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ipggi.wordpress.com/1023/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ipggi.wordpress.com/1023/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=1023&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ipggi.wordpress.com/2013/04/23/run-dos-on-the-raspberry-pi-use-rpix86-to-turn-your-pi-into-a-1980s-super-computer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01aa96818e11d6d361d9832c957f8a0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ipggi</media:title>
		</media:content>

		<media:content url="http://www.mobygames.com/images/shots/l/170148-snooper-troops-dos-screenshot-title-screens.png" medium="image" />

		<media:content url="http://www.mobygames.com/images/shots/l/148246-troll-s-tale-pc-booter-screenshot-hmm-some-huts-to-explore.png" medium="image" />

		<media:content url="http://www.mobygames.com/images/shots/l/16057-king-s-quest-iii-to-heir-is-human-dos-screenshot-seaside-towns.gif" medium="image" />

		<media:content url="http://www.mobygames.com/images/shots/l/17905-moebius-the-orb-of-celestial-harmony-dos-screenshot-starting.gif" medium="image" />

		<media:content url="http://www.mobygames.com/images/shots/l/2085-king-s-quest-v-absence-makes-the-heart-go-yonder-dos-screenshot.gif" medium="image" />

		<media:content url="http://www.mobygames.com/images/shots/l/14368-links-386-pro-dos-screenshot-harbour-town-on-the-green-hole.gif" medium="image" />

		<media:content url="http://ipggi.files.wordpress.com/2013/04/raspi-config.png" medium="image">
			<media:title type="html">raspi-config</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/04/mkdir-_dos.png" medium="image">
			<media:title type="html">mkdir ~/dos</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/04/wget-rpix86-tar-gz.png" medium="image">
			<media:title type="html">wget rpix86.tar.gz</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/04/rpix86.png" medium="image">
			<media:title type="html">rpix86</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/04/rpix86-unable-to-find-4dos-com.png" medium="image">
			<media:title type="html">rpix86 unable to find 4dos.com</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/04/rpix86-startup.png" medium="image">
			<media:title type="html">rpix86 startup</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/04/dos-commands.png?w=126" medium="image">
			<media:title type="html">DOS commands.</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/04/raspian-wget-dott.png?w=150" medium="image">
			<media:title type="html">wget DOTT</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/04/rpix86-dos-for-dott.png?w=150" medium="image">
			<media:title type="html">DOS for DOTT</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/04/rpix86-dott-demo.png?w=150" medium="image">
			<media:title type="html">DOTT DEMO</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/04/rpix86-sq3-demo.png?w=150" medium="image">
			<media:title type="html">SQ3DEMO.BAT</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/04/rpix86-digger.png?w=150" medium="image">
			<media:title type="html">DIGGER.COM</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/04/rpix86-zone66-abort.png?w=150" medium="image">
			<media:title type="html">ZONE66.EXE</media:title>
		</media:content>
	</item>
		<item>
		<title>Use USB hard disk &amp; flash drives with your Raspberry Pi</title>
		<link>http://ipggi.wordpress.com/2013/03/21/using-usb-external-hard-disk-flash-drives-with-to-your-raspberry-pi/</link>
		<comments>http://ipggi.wordpress.com/2013/03/21/using-usb-external-hard-disk-flash-drives-with-to-your-raspberry-pi/#comments</comments>
		<pubDate>Thu, 21 Mar 2013 07:00:02 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Disk Management]]></category>
		<category><![CDATA[EXT3]]></category>
		<category><![CDATA[EXT4]]></category>
		<category><![CDATA[FAT32]]></category>
		<category><![CDATA[Hard disk drive]]></category>
		<category><![CDATA[HFS+]]></category>
		<category><![CDATA[NTFS]]></category>
		<category><![CDATA[Storage]]></category>
		<category><![CDATA[USB]]></category>
		<category><![CDATA[USB flash drive]]></category>

		<guid isPermaLink="false">http://ipggi.wordpress.com/?p=992</guid>
		<description><![CDATA[This was meant to be a brief article on how to mount an external USB drive, but it quickly spiralled out when I starting writing about all the nuances and potential issues one might run into. So I have a created a quick summary of the commands on how to mount a drive below. But [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=992&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This was meant to be a brief article on how to mount an external USB drive, but it quickly spiralled out when I starting writing about all the nuances and potential issues one might run into. So I have a created a quick summary of the commands on how to mount a drive below. But I highly recommend reading the rest of the article as there are a number of potential pitfalls with the Pi and external USB drives that are addressed.</p>
<h2>In-brief</h2>
<h3>To mount a USB drive:</h3>
<p><code>sudo mkdir /mnt/usbdrive<br />
sudo mount /dev/sda1 /mnt/usbdrive<br />
ls /mnt/usbdrive</code></p>
<h3>To list your file systems:</h3>
<p><code>sudo fdisk -l<br />
sudo mount -l<br />
df -h</code></p>
<h3>Before disconnecting a USB drive:</h3>
<p><code>sudo umount /dev/sda1</code></p>
<h3>Format a drive to EXT4</h3>
<p><code>sudo mkfs.ext4 /dev/sda1 -L untitled</code></p>
<h3>Add Apple OS X HFS+ read/write support</h3>
<p><code>sudo apt-get install hfsutils hfsprogs hfsutils</code></p>
<h3>Format a drive to HFS+</h3>
<p><code>sudo mkfs.hfsplus /dev/sda1 -v untitled</code></p>
<h3>Add Windows NTFS read/write support</h3>
<p><code>sudo apt-get install ntfs-3g</code></p>
<h3>Format a drive to NTFS</h3>
<p><code>sudo mkfs.ntfs /dev/sda1 -f -v -I -L untitled</code></p>
<h3>Add Windows/DOS FAT32 read/write support</h3>
<p><code>sudo apt-get install dosfstools</code></p>
<h3>Format a drive to FAT32</h3>
<p><code>sudo mkfs.vfat /dev/sda1 -n untitled</code></p>
<h2>In-depth</h2>
<p>The Raspberry Pi is a great and flexible little device. But one of its main limitations is the storage options if you wish to use the device as a file or multimedia server. SD memory cards are cheap and common with low-end specifications but reach an affordability and storage cap when their sizes increase. A cheap USB powered external drive with many times more space can be had for a similar price to a top capacity SD memory card.</p>
<h3>USB Power Problems</h3>
<p>A major limitation for running a USB drive on a Raspberry Pi are the power requirements. The Universal Serial Bus specification states that to adhere to the standard, up to 0.5A (amps) can be drawn from a single port.</p>
<p>My old Samsung G2 Portable 640 hard drive requires 0.85A to work which is 0.35A above the USB2 specification. This is not an isolated example, many modern desktop PCs and laptops supply a greater amperage than the standard 0.5A to their USB ports to support devices such as portable USB hard drives. Unfortunately the Pi cannot power many external USD devices such as hard drives as its USB ports are restricted to the standard amperage.</p>
<p>To get around this problem you need a powered USB hub. You attach the hub device to the Pi&#8217;s USB port, plug the USB hard drive into one of the hub&#8217;s USB ports and insert the hub&#8217;s power supply into a walled power socket. My tiny Logitech &#8216;Premium 4-port&#8217; USB hub can share 2.5A between 4 devices which is more than enough to power my Samsung drive.</p>
<p>I would also recommend against powering the Raspberry Pi off the same USB Hub as a USB drive. For me this caused interference where the drive would momentary lose power.</p>
<h3>Mounting A Drive</h3>
<p>When a drive is mounted, it connects to your Pi and Linux recognises it. The drive is given a directory where you are able to access and modify its content. These directories are known as mount points and can be given any name that works for you but they should be placed in <code>/mnt</code>.</p>
<p>I will call my mount point &#8216;<code>usbdrive</code>&#8216;. First we need to create a mount point.</p>
<p><code>sudo mkdir /mnt/usbdrive</code></p>
<p>Linux has the <code>/dev</code> directory that is in use to store special files that allow access to the computer&#8217;s hardware. The <code>/dev/sd*</code> collection of files represent drives. Each drive connected to your Raspberry Pi is given a letter.</p>
<p><code>/dev/sda</code> Would be your first connected drive.<br />
<code>/dev/sdb</code> Would be your second drive.</p>
<p>To mount the drive to your mount point &#8216;<code>usbdrive</code>&#8216;.</p>
<p><code>sudo mount /dev/sda1 /mnt/usbdrive</code></p>
<p>The numeric <code>1</code> at the end of <code>/dev/sda</code> is a requirement and tells Linux to mount the first partition.</p>
<p>Partitions are beyond the scope of this article, but you can learn more about that at the <a href="https://help.ubuntu.com/community/DualBoot/Partitions">Ubuntu Community Docs</a>.</p>
<p><a href="http://ipggi.files.wordpress.com/2013/03/mkdir-mnt-usbdrive.png"><img class="alignnone size-full wp-image-1009" alt="mkdir mnt usbdrive" src="http://ipggi.files.wordpress.com/2013/03/mkdir-mnt-usbdrive.png?w=620"   /></a></p>
<h3>Disconnect / Unmount A Drive</h3>
<p>It is always advisable that you unmount a USB drive before unplugging it from its power source. This forces all queued data to be written to the drive before it loses power.</p>
<p><code>sudo umount /dev/sda1</code></p>
<p>You may need to use the <code>-f</code> force option if the drive will not dismount.</p>
<p><code>sudo umount -f /dev/sda1</code></p>
<p>If you use the <code>shutdown -P -h 0</code> command to power down your Pi you do not need to use unmount.</p>
<h3>Disk File Systems</h3>
<p>A disk file system is the method an operating system stores and reads data on a drive. There is an endless list of disk file systems out there as each operating system seems to have their own native but incompatible system.</p>
<p>Linux as a number of native file formats but generally today the most common is the EXT (<a href="http://www.thegeekstuff.com/2011/05/ext2-ext3-ext4/">Extended File System</a>) series which include <em>ext2</em>, <em>ext3</em> and <em>ext4</em>.</p>
<p>Apple OS X uses <em>HFS+</em> (Hierarchical File System Plus) otherwise known as Mac OS Extended.</p>
<p>Modern Microsoft Windows systems mostly use <em>NTFS</em> (New Technology File System).</p>
<p>Legacy Microsoft Windows systems and ancient Microsoft DOS systems generally use a variation of the <em>FAT</em> (File Allocation Table) which includes <em>FAT</em>, <em>VFAT</em>, <em>FAT32</em> and <em>exFAT</em>.</p>
<div id="attachment_1015" class="wp-caption alignnone" style="width: 786px"><a href="http://ipggi.files.wordpress.com/2013/03/cpu-usage-when-using-ntfs-3-and-ntfs-to-write.png"><img class=" wp-image-1015 " alt="High CPU usage with the ntfs-3 driver" src="http://ipggi.files.wordpress.com/2013/03/cpu-usage-when-using-ntfs-3-and-ntfs-to-write.png?w=776&#038;h=207" width="776" height="207" /></a><p class="wp-caption-text">Excessive CPU usage with the ntfs-3 driver that slows Samba (smdb) transfers</p></div>
<div id="attachment_1016" class="wp-caption alignnone" style="width: 786px"><a href="http://ipggi.files.wordpress.com/2013/03/copy-from-desktop-sd-to-pi-usb-hd-ext4-format.png"><img class=" wp-image-1016 " alt="xxx" src="http://ipggi.files.wordpress.com/2013/03/copy-from-desktop-sd-to-pi-usb-hd-ext4-format.png?w=776&#038;h=224" width="776" height="224" /></a><p class="wp-caption-text">With EXT4 the file transfer using Samba has an additional 250%+ CPU resource available for use</p></div>
<h3>Disk File Systems Compatibility</h3>
<p><strong>EXT</strong> has native support in Linux and the Raspberry Pi. It has no official support in Windows. There are free third party drivers available for Windows offering limited read/write EXT support such as the open source <a href="http://sourceforge.net/projects/ext2fsd/">EXT2FSD</a> or <a href="http://sourceforge.net/projects/ext2read/">EXT2Read</a>. Apple OS X users need to use the commercial Paragon <a href="http://www.paragon-software.com/home/extfs-mac/">ExtFS</a> to enable full EXT support.</p>
<p>To enable Linux EXT4 support:<br />
It is turned on by default on the Raspberry Pi.</p>
<p><strong>HFS+</strong> has restricted support in Linux. It can read HFS+ formatted drives but can only write to them if <a href="https://help.ubuntu.com/community/hfsplus">journaling is disabled</a>. Windows has no native HFS+ support but there are paid solutions such as <a href="http://www.paragon-software.com/home/hfs-windows/">Paragon HFS+ for Windows</a>.</p>
<p>To enable Linux HFS+ support:<br />
<code>sudo apt-get install hfsutils hfsprogs hfsutils</code></p>
<p><strong>FAT</strong> is probably the most supported file system but it is also the most limited. Linux, Windows and Apple OS X all support FAT, VFAT and FAT32. ExFAT otherwise known as FAT64 is native to modern Windows and Apple OS X but has no support in Linux due to patient incompatibilities.</p>
<p>To enable Linux FAT32 support:<br />
<code>sudo apt-get install dosfstools</code></p>
<p><strong>NTFS</strong> has read only support in Linux and Apple OS X. Third party drivers are available to add write support including the commercial <a href="http://www.paragon-software.com/home/ntfs-mac">Paragon NTFS</a> and the open source <a href="http://sourceforge.net/projects/ntfs-3g/">NTFS-3g</a>.</p>
<p>To enable Linux NTFS support:<br />
<code>sudo apt-get install ntfs-3g</code></p>
<h3>Performance Issues &amp; Which Disk File System To Use?</h3>
<p>As a non-scientific test I took a 4GB video file and copied it to various file systems using my Raspberry Pi and the USB hard drive.</p>
<p>The worst performer by far was the NTFS-3g driver for Linux NTFS read and write support.</p>
<p>The transfer that 4GB file from my Windows 7 PC to the NTFS formatted USB hard drive took around a minute or two. The same file from the Raspberry Pi&#8217;s SD memory card to the NTFS formatted USB drive took 30 minutes to write and 23 minutes to read!</p>
<p>Performance for EXT3, EXT4 and FAT32 were about the same at 12-14 minutes to both read and write. This suggests that there is a bottleneck with either the SD memory card or USB drivers and not the file system.</p>
<p>If your drives are mostly used by the Pi my recommendation would be to use EXT4 on your USB drives. EXT4 is mostly the same as EXT3 with some extra minor features but it is widely supported in the Linux world, plus it is backwards compatible with EXT3 and EXT2.</p>
<p>FAT32 is the most compatible file system but has a restrictive 4GB file size limit.</p>
<p>EXT2, HFS+ on Linux and FAT32 lack journaling support that makes them prone to errors when used on portable drives. As these file systems can&#8217;t elegantly recover if they unexpectedly lose power.</p>
<p>FAT32, NTFS can not store Linux file or user permissions.</p>
<h3>Format A Drive</h3>
<p>To change the file system of a drive you need to format it. Linux allows you to format any supported disk format using the <code>mkfs</code> tool.</p>
<p>In the examples below you will notice an option followed by &#8216;<code>untitled</code>&#8216;. These are optional volume labels to name your drive.</p>
<p>First you must unmount the drive you wish to format.</p>
<p><code>sudo umount /dev/sda1</code></p>
<p>To format a drive to EXT3 (Linux):<br />
<code>sudo mkfs.ext3 /dev/sda1 -L untitled</code></p>
<p>To format a drive to EXT4 (Linux):<br />
<code>sudo mkfs.ext4 /dev/sda1 -L untitled</code></p>
<p>To format a drive to HFS+ (Mac OS X):<br />
<code>sudo mkfs.hfsplus /dev/sda1 -v untitled</code></p>
<p>To format a drive to FAT32 (DOS and legacy Windows):<br />
<code>sudo mkfs.vfat /dev/sda1 -n untitled</code></p>
<p>To format a drive to NTFS (Windows):<br />
<code>sudo mkfs.ntfs /dev/sda1 -f -v -I -L untitled</code></p>
<p>I have applied a few options here that I will explain.<br />
<code>-f</code> <em>Fast Format</em>. Due to the poor performance of 3g.ntfs on the Pi I highly recommend using the less CPU intensive fast format mode.<br />
<code>-v</code> <em>Verbose</em>. By default the NTFS status output is limited so this lets you know what is happening.<br />
<code>-I</code> <em>Disable Windows Indexing</em>. This improves the write performance of the drive but it will mean Windows Search queries used on this drive will take longer.</p>
<div id="attachment_1013" class="wp-caption alignnone" style="width: 630px"><a href="http://ipggi.files.wordpress.com/2013/03/mkfs-ntfs.png"><img class=" wp-image-1013   " alt="Format NTFS" src="http://ipggi.files.wordpress.com/2013/03/mkfs-ntfs.png?w=620" width="620" /></a><p class="wp-caption-text">Format NTFS</p></div>
<div id="attachment_1012" class="wp-caption alignnone" style="width: 630px"><a href="http://ipggi.files.wordpress.com/2013/03/mkfs-hfsplus.png"><img class="size-full wp-image-1012" alt="Format HFS+" src="http://ipggi.files.wordpress.com/2013/03/mkfs-hfsplus.png?w=620&#038;h=36" width="620" height="36" /></a><p class="wp-caption-text">Format HFS+</p></div>
<div id="attachment_1011" class="wp-caption alignnone" style="width: 630px"><a href="http://ipggi.files.wordpress.com/2013/03/mkfs-fat32.png"><img class="size-full wp-image-1011" alt="Format FAT32 (vfat)" src="http://ipggi.files.wordpress.com/2013/03/mkfs-fat32.png?w=620&#038;h=35" width="620" height="35" /></a><p class="wp-caption-text">Format FAT32 (vfat)</p></div>
<div id="attachment_1010" class="wp-caption alignnone" style="width: 630px"><a href="http://ipggi.files.wordpress.com/2013/03/mkfs-ext4.png"><img class="size-full wp-image-1010" alt="Format EXT4" src="http://ipggi.files.wordpress.com/2013/03/mkfs-ext4.png?w=620&#038;h=289" width="620" height="289" /></a><p class="wp-caption-text">Format EXT4</p></div>
<h3>Automatically Mount A Drive</h3>
<p>To simplify the process of mounting a drive you can add the drive&#8217;s information to the <code>fstab</code> settings file located in <code>/etc/</code>. I would recommend taking a look at the <a href="https://help.ubuntu.com/community/Fstab">Ubuntu FSTAB community page</a> for a deeper understanding of this file.</p>
<p>First run <code>nano</code> to edit <code>fstab</code>. The <code>-Bw</code> options tell nano to backup the file and not to use any line-wrap.</p>
<p><code>sudo nano -Bw /etc/fstab</code></p>
<p>You should already see some existing entries. Do <strong>NOT</strong> change these as the two <code>/mnt/mmcblk0p</code> entries are there to mount the SD card.</p>
<p>Add the following to the bottom of the file.</p>
<p><code>/dev/sda1 /mnt/usbdisk auto defaults,user 0 1</code></p>
<p>These are explained:</p>
<p><code>/dev/sda1</code> Is the location of the drive to mount.<br />
<code>/mnt/usbdisk</code> Is the mount point, which is the folder to access the content of the drive.<br />
<code>auto</code> Is the file system type, here you can set &#8216;<code>auto</code>&#8216; or force a file system type such as <code>ext2</code>, <code>ext3</code>, <code>ext4</code>, <code>hfsplus</code>, <code>ntfs</code>, <code>vfat</code>.<br />
<code>defaults,user</code> Are mount options. You normally need to only supply &#8216;<code>defaults</code>&#8216;. Though there are some others that maybe useful such as &#8216;<code>ro</code>&#8216; for read-only or &#8216;<code>user</code>&#8216; to enable write permission for all users. Use a non-spaced comma to separate multiple options.<br />
<code>0</code> A binary value used for debugging. It is best to keep this set at zero.<br />
<code>1</code> <a href="http://manpages.ubuntu.com/manpages/hardy/man8/fsck.8.html">Pass number for a file system check at boot</a>. &#8216;<code>0</code>&#8216; (zero) to disable or &#8216;<code>2</code>&#8216; to enable.</p>
<p>Save the changes to <code>fstab</code>.</p>
<p><code>[Ctrl] x</code><br />
<code>Y</code> at the <em>Save modified buffer</em> prompt.<br />
<code>[Enter]</code> for the <em>File name to Write: /etc/fstab prompt</em>.</p>
<p><a href="http://ipggi.files.wordpress.com/2013/03/nano-etc-fstab.png"><img class="alignnone size-full wp-image-1007" alt="nano etc fstab" src="http://ipggi.files.wordpress.com/2013/03/nano-etc-fstab.png?w=620&#038;h=250" width="620" height="250" /></a></p>
<p>The drive will mount at boot as long as it is attached to the Pi. If you want to mount the drive after you have plugged it in use mount with the automatic option.</p>
<p><code>sudo mount -a</code></p>
<br />Filed under: <a href='http://ipggi.wordpress.com/category/linux/'>Linux</a>, <a href='http://ipggi.wordpress.com/category/raspberry-pi/'>Raspberry Pi</a> Tagged: <a href='http://ipggi.wordpress.com/tag/apple/'>Apple</a>, <a href='http://ipggi.wordpress.com/tag/disk-management/'>Disk Management</a>, <a href='http://ipggi.wordpress.com/tag/ext3/'>EXT3</a>, <a href='http://ipggi.wordpress.com/tag/ext4/'>EXT4</a>, <a href='http://ipggi.wordpress.com/tag/fat32/'>FAT32</a>, <a href='http://ipggi.wordpress.com/tag/hard-disk-drive/'>Hard disk drive</a>, <a href='http://ipggi.wordpress.com/tag/hfs/'>HFS+</a>, <a href='http://ipggi.wordpress.com/tag/ntfs/'>NTFS</a>, <a href='http://ipggi.wordpress.com/tag/raspberry-pi/'>Raspberry Pi</a>, <a href='http://ipggi.wordpress.com/tag/storage/'>Storage</a>, <a href='http://ipggi.wordpress.com/tag/usb/'>USB</a>, <a href='http://ipggi.wordpress.com/tag/usb-flash-drive/'>USB flash drive</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ipggi.wordpress.com/992/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ipggi.wordpress.com/992/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=992&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ipggi.wordpress.com/2013/03/21/using-usb-external-hard-disk-flash-drives-with-to-your-raspberry-pi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01aa96818e11d6d361d9832c957f8a0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ipggi</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/03/mkdir-mnt-usbdrive.png" medium="image">
			<media:title type="html">mkdir mnt usbdrive</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/03/cpu-usage-when-using-ntfs-3-and-ntfs-to-write.png" medium="image">
			<media:title type="html">High CPU usage with the ntfs-3 driver</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/03/copy-from-desktop-sd-to-pi-usb-hd-ext4-format.png" medium="image">
			<media:title type="html">xxx</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/03/mkfs-ntfs.png" medium="image">
			<media:title type="html">Format NTFS</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/03/mkfs-hfsplus.png" medium="image">
			<media:title type="html">Format HFS+</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/03/mkfs-fat32.png" medium="image">
			<media:title type="html">Format FAT32 (vfat)</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/03/mkfs-ext4.png" medium="image">
			<media:title type="html">Format EXT4</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/03/nano-etc-fstab.png" medium="image">
			<media:title type="html">nano etc fstab</media:title>
		</media:content>
	</item>
		<item>
		<title>Using a Point-to-Point Tunnelling Protocol, Virtual Private Network (PPTP VPN) client on a Raspberry Pi</title>
		<link>http://ipggi.wordpress.com/2013/02/19/using-a-point-to-point-tunnelling-protocol-virtual-private-network-pptp-vpn-client-on-a-raspberry-pi/</link>
		<comments>http://ipggi.wordpress.com/2013/02/19/using-a-point-to-point-tunnelling-protocol-virtual-private-network-pptp-vpn-client-on-a-raspberry-pi/#comments</comments>
		<pubDate>Tue, 19 Feb 2013 01:51:00 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[poff]]></category>
		<category><![CDATA[Point-to-Point Tunneling Protocol]]></category>
		<category><![CDATA[pon]]></category>
		<category><![CDATA[pppd]]></category>
		<category><![CDATA[pptp]]></category>
		<category><![CDATA[pptp-linux]]></category>
		<category><![CDATA[pptpsetup]]></category>
		<category><![CDATA[raspbian]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Virtual Private Network]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://ipggi.wordpress.com/?p=925</guid>
		<description><![CDATA[Why use a VPN? VPN or a Virtual Private Network is a common way of securing an Internet connection using encryption. Basically a VPN sets a trusted, designated server on the Internet to act as a man in the middle. As a VPN client, all your web traffic gets encrypted and directed to this designated [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=925&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<h2>Why use a VPN?</h2>
<p>VPN or a Virtual Private Network is a common way of securing an Internet connection using encryption.</p>
<p>Basically a VPN sets a trusted, designated server on the Internet to act as a man in the middle. As a VPN client, all your web traffic gets encrypted and directed to this designated machine. It decrypts and then reroutes the traffic to its intended destination. This gives you a both benefits and disadvantages.</p>
<p>Having an encrypted connection between yourself and a trusted VPN server means your Internet traffic is mostly safe from snoopers. That could be anyone on the same Wi-Fi network as you, your ISP or even big-brother governments.</p>
<p>If you are behind a government or corporate firewall, the VPN could be used to reach blacklisted websites. As the firewall will only see that your traffic is directed to the designated VPN server.</p>
<p>A VPN also allows you to hide the point of origin of your Internet request from your destination. As the designated server intercepts and decrypts your Internet traffic before it resents it. This fools the destination to believe the Internet request came from the designated server and not from you.</p>
<p>If a website or service has region restrictions placed on it to allow only users from particular countries access. A VPN server hosted in a permitted country allows you to bypass this form of restriction.</p>
<p>The most obvious disadvantage in using a VPN server is that adding an extra layer of Internet bureaucracy slows down your overall Internet experience. The encryption requires more processing time and it consumes more bandwidth. Plus adding a man the middle means your Internet traffic isn&#8217;t going to be traversing across the Internet via the quickest possible route.</p>
<h2>About this project</h2>
<p>For this project I am going to carry out a VPN client connection on a Raspberry Pi without using any GUI tools. This could be used with a headless or server Raspbian Pi set-up. It should also work fine on a <a href="http://www.ubuntu.com/">Ubuntu based</a> Linux system.</p>
<p>Also this tutorial will use the most common VPN protocol PPTP, known as the <em>Point-to-Point Tunnelling Protocol</em>. Its encryption is not as secure or as safe as some other VPN options but it is the most supported of the protocols out there.</p>
<h2>Software installs and updates</h2>
<p>First in a Pi shell we need to update our repositories, our Pi operating system and install <em>PPTP for Linux</em>.</p>
<p><code>sudo apt-get update -y<br />
sudo apt-get upgrade -y<br />
sudo apt-get install -y pptp-linux</code></p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/sudo-apt-get-install-pptp-linux.png"><img class="alignnone size-full wp-image-927" alt="sudo apt-get install pptp-linux" src="http://ipggi.files.wordpress.com/2013/02/sudo-apt-get-install-pptp-linux.png?w=620"   /></a></p>
<h2>Setup and configuration</h2>
<p>The <code>pptp-linux</code> installation includes the very useful <a href="http://en.wikipedia.org/wiki/Perl">Perl script</a> <code>pptpsetup</code> that is found at <code>/usr/sbin/pptpsetup</code>.</p>
<p>List the help options for <code>pptpsetup</code>.</p>
<p><code>pptpsetup --help</code></p>
<p><code>pptpsetup</code> has 6 options to create a PPTP connection configuration.</p>
<p><code>pptpsetup</code><br />
<code>--create</code> <em>[tunnel name]</em><br />
<code>--server</code> <em>[vpn server]</em><br />
<code>--username</code> <em>[vpn server username]</em><br />
<code>--password</code> <em>[vpn server password]</em><br />
<code>--encrypt</code> (optional)<br />
<code>--start</code> (optional)</p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/pptpsetup-help.png"><img class="alignnone size-full wp-image-933" alt="pptpsetup --help" src="http://ipggi.files.wordpress.com/2013/02/pptpsetup-help.png?w=620"   /></a></p>
<p>Example usage of <code>pptpsetp</code>.</p>
<p><code>sudo pptpsetup --create examplela --server pptp-la.example.com --username exampleuser --password examplepassword --start</code></p>
<p>The <code>--create</code> option is the <em>&#8216;tunnel&#8217;</em> name you wish to give your connection. It can not have spaces or weird characters and should be something that is descriptive of the VPN server it will connect to such as a geographical location.</p>
<p><code>--server</code> Is the address of the VPN server to connect to.</p>
<p><code>--username</code> Is your assigned user name used to authorise access to the VPN server.</p>
<p><code>--password</code> Is the password required by the user name.</p>
<p><code>--encrypt</code> Toggles encryption for all communication between your Pi and the VPN server. While this setting is optional, most VPN servers will not accept a connection unless encryption is in use.</p>
<p><code>--start</code> Will connect to the VPN after creating your new connection configuration.</p>
<p>For the rest of this tutorial I will use my real world example of <code>pptpsetup</code>. Replace any references to my <em>proxpnuk</em> configuration with your own VPN server configuration.</p>
<p><code>sudo pptpsetup --create proxpnuk --server pptp-uk1.proxpn.com --username xxxx --password xxxx --encrypt --start</code></p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/pptpsetup-realworld.png"><img class="alignnone  wp-image-939" alt="pptpsetup realworld" src="http://ipggi.files.wordpress.com/2013/02/pptpsetup-realworld.png?w=920&#038;h=162" width="920" height="162" /></a></p>
<p>If you have a <em>Connection termination</em> but you are sure your server address, user name and password are correct, try using the <code>--encrypt</code> option.</p>
<p><code>pptpsetup</code> creates a configuration file that gets placed in <code>/etc/ppp/peers/</code> which is a superuser protected directory so you will need to run <code>sudo</code> to view its content.</p>
<p><code>sudo ls -l /etc/ppp/peers/<br />
sudo cat /etc/ppp/peers/proxpnuk</code></p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/cat-proxpnuk.png"><img class="alignnone size-full wp-image-971" alt="cat proxpnuk" src="http://ipggi.files.wordpress.com/2013/02/cat-proxpnuk.png?w=620"   /></a></p>
<p>You can see your <i>point-to-point protocol </i>connection using <code>ifconfig -s</code>. It should be listed under <em>ppp0</em>.</p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/ifconfig-s1.png"><img class="alignnone size-full wp-image-972" alt="ifconfig -s" src="http://ipggi.files.wordpress.com/2013/02/ifconfig-s1.png?w=620&#038;h=89" width="620" height="89" /></a></p>
<p><code>pptpsetup</code> can also be used to delete an existing configuration file.</p>
<p><code>sudo pptpsetup --delete <em>[tunnel name]</em></code></p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/pptpsetup-delete.png"><img class="alignnone size-full wp-image-984" alt="pptpsetup delete" src="http://ipggi.files.wordpress.com/2013/02/pptpsetup-delete.png?w=620"   /></a></p>
<h2>Usage</h2>
<p><em>PPTP for Linux</em> also installed two Bash scripts that are used to connect and disconnect to your PPTP VPN server. You can use the <code>-h</code> option to see the scripts help text.</p>
<p><code>/usr/bin/pon</code> and <code>/usr/bin/poff</code> are scripts that call the <code>/usr/sbin/pppd</code> application. <code>pppd</code> known as the <em>Point-to-Point Protocol Daemon</em> is a complicated program but if needed its manual with an endless list of options can be found at <a href="http://ppp.samba.org/pppd.html">http://ppp.samba.org/pppd.html</a></p>
<p><code>pon -h<br />
poff -h</code></p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/pon-and-poff-h.png"><img class="alignnone size-full wp-image-944" alt="pon and poff -h" src="http://ipggi.files.wordpress.com/2013/02/pon-and-poff-h.png?w=620&#038;h=483" width="620" height="483" /></a></p>
<p>If connected let us disconnect our current <em>ppp</em> connection using the <code>poff</code> script.</p>
<p><code>sudo poff -a<br />
ifconfig -s</code></p>
<p><code>Ifconfig</code> should only list <em>eth0</em> and <em>lo</em> under the <em>Iface</em> column.</p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/ifconfig-s.png"><img class="alignnone size-full wp-image-945" alt="ifconfig -s" src="http://ipggi.files.wordpress.com/2013/02/ifconfig-s.png?w=620&#038;h=89" width="620" height="89" /></a></p>
<p>Let us reconnect again.</p>
<p><code>sudo pon proxpnuk updetach<br />
ifconfig -s</code></p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/sudo-pon-proxpnuk-updetach.png"><img class="alignnone size-full wp-image-976" alt="sudo pon proxpnuk updetach" src="http://ipggi.files.wordpress.com/2013/02/sudo-pon-proxpnuk-updetach.png?w=620&#038;h=182" width="620" height="182" /></a></p>
<p>To see your connection settings for troubleshooting.</p>
<p><code>sudo pon proxpnuk debug dump</code></p>
<p>To save the debug output to a file and view it.</p>
<p><code>sudo pon proxpnuk debug dump &gt; ~/proxpnuk-debug.txt<br />
cat ~/proxpnuk-debug.txt</code></p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/pon-proxpnuk-dump-proxpnuk-debug-txt.png"><img class="alignnone size-full wp-image-948" alt="pon proxpnuk dump proxpnuk-debug.txt" src="http://ipggi.files.wordpress.com/2013/02/pon-proxpnuk-dump-proxpnuk-debug-txt.png?w=620&#038;h=283" width="620" height="283" /></a></p>
<p><em>PPTP for Linux</em> has a log file that can also be useful for troubleshooting. It is found at <code>/var/log/messages</code>. The <code>tail</code> command normally displays the last 10 lines of text file but when it&#8217;s combined with the <code>-f</code> follow option it displays the most recent text appended to the file.</p>
<p><code>tail -f /var/log/messages</code></p>
<p>Press <code>[Ctrl] C</code> to exit <code>tail</code>.</p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/tail-f-var-log-messages.png"><img class="alignnone size-full wp-image-977" alt="tail -f var log messages" src="http://ipggi.files.wordpress.com/2013/02/tail-f-var-log-messages.png?w=620&#038;h=190" width="620" height="190" /></a></p>
<p><span style="font-size:1.5em;">Test for a VPN connection</span></p>
<p>I use the <code>traceroute</code> command to test for an active VPN connection. First make sure there is no <em>ppp0</em> connection.</p>
<p><code>sudo poff -a<br />
ifconfig -s</code></p>
<p>Then run <code>traceroute</code> to a well-known website such as <em>google.com</em>.</p>
<p><code>traceroute google.com</code></p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/traceroute-google-com-no-vpn1.png"><img class="alignnone size-full wp-image-966" alt="traceroute google.com no vpn" src="http://ipggi.files.wordpress.com/2013/02/traceroute-google-com-no-vpn1.png?w=620&#038;h=175" width="620" height="175" /></a></p>
<p>Make a note of the number of hops. In my case it took 8 hops for a request from my Raspberry Pi to reach Google&#8217;s servers.</p>
<p>Now if we enable our <em>ppp0</em> connection and try again, you will probably discover that connecting to Google takes exactly the same number of hops.</p>
<p><code>sudo pon proxpnuk updetach<br />
traceroute google.com</code></p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/traceroute-google-com-no-route1.png"><img class="alignnone size-full wp-image-963" alt="traceroute google.com no route" src="http://ipggi.files.wordpress.com/2013/02/traceroute-google-com-no-route1.png?w=620&#038;h=352" width="620" height="352" /></a></p>
<p>This probably means the internet traffic sent and received from the Pi is not using our VPN connection.</p>
<p>We need to create a route to <em>tunnel</em> our Internet traffic through our VPN. The route command at <code>/bin/route</code> is perfect to carry out this task.</p>
<p><code>sudo route add -net "0.0.0.0/0" dev "ppp0"</code></p>
<p>The <code>-net 0.0.0.0/0</code> sets the target network of the route to be the default route. <code>dev</code> toggles a device to reroute our traffic to. While PPP connection number one <code>ppp0</code> is that device.</p>
<p>To check if our route was successful use <code>netstat</code> with the <code>-a</code> all sockets option and feed the output into <code>grep</code> to filter and display only the lines that contain the string <code>"/var/run/pptp/"</code>. These lines signify our PPTP routes.</p>
<p><code>netstat -a | grep "/var/run/pptp/"</code></p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/route-add.png"><img class="alignnone size-full wp-image-958" alt="route add" src="http://ipggi.files.wordpress.com/2013/02/route-add.png?w=620&#038;h=63" width="620" height="63" /></a></p>
<p>Test your connection again and you should have a greater number of hops than last time.</p>
<p><code>traceroute google.com</code></p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/traceroute-google-com-with-route.png"><img class="alignnone size-full wp-image-959" alt="traceroute google.com with route" src="http://ipggi.files.wordpress.com/2013/02/traceroute-google-com-with-route.png?w=620&#038;h=224" width="620" height="224" /></a></p>
<p>That meant the connection to Google.com from your Pi had rerouted through your VPN server. Congratulations.</p>
<h2>VPN at boot</h2>
<p>To automatically connect your Pi to a VPN server at start-up I&#8217;d recommend placing the following script into <code>/etc/rc.local</code>. This file runs all commands within as a superuser, at the end of a Pi boot but before the user login prompt. I use the <code>-B</code> option with the <code>nano</code> text editor to backup the <code>rc.local</code> file before making any changes to it.</p>
<p><code>sudo nano -B /etc/rc.local</code></p>
<p>Make sure you insert any script before the <code>exit 0</code> line and after the hashed <code>#</code> comments.</p>
<p><code>vpn="on"<br />
if [ $vpn = on ]; then<br />
printf "\nVPN connection to ProXPN UK\n"<br />
pon proxpnuk updetach<br />
printf "Add Internet traffic route through ppp0\n"<br />
sudo route add -net "0.0.0.0/0" dev "ppp0"<br />
printf "Netstat output of all PPTP sockets\n"<br />
netstat -a | grep "/var/run/pptp/"<br />
fi</code></p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/nano-etc-rc-local.png"><img class="alignnone size-large wp-image-978" alt="nano etc rc.local" src="http://ipggi.files.wordpress.com/2013/02/nano-etc-rc-local.png?w=620&#038;h=476" width="620" height="476" /></a></p>
<p>The script is pretty self-explanatory and I have contained it within a conditional statement to disable if needed. To do this simply change the <code>vpn="on"</code> variable to something else such as <code>vpn="off"</code>.</p>
<p>In nano press the <code>[Ctrl] X</code> keys to prompt for a <em>Save modified buffer?</em> query. Answer Y at the prompt to save and press enter to keep the current <em>File Name to Write</em>.</p>
<p>You don&#8217;t need to reboot to test your changes to <code>rc.local</code>.</p>
<p><code>sudo /etc/rc.local</code></p>
<p>Executes the script same way as it would with a reboot.</p>
<p>&nbsp;</p>
<p><a href="http://ipggi.files.wordpress.com/2013/02/sudo-etc-rc-local1.png"><img class="alignnone size-full wp-image-990" alt="sudo etc rc.local" src="http://ipggi.files.wordpress.com/2013/02/sudo-etc-rc-local1.png?w=620&#038;h=234" width="620" height="234" /></a></p>
<h2>fi</h2>
<p>I am happy to reply to any questions about this post but I am no expert on the subject of VPN and can not help in setting up a VPN server or using other client protocols such as <a href="https://help.ubuntu.com/community/OpenVPN">OpenVPN</a>. Extracting this information on <em>PPTP for Linux</em> was quite time-consuming.</p>
<br />Filed under: <a href='http://ipggi.wordpress.com/category/linux/'>Linux</a>, <a href='http://ipggi.wordpress.com/category/raspberry-pi/'>Raspberry Pi</a> Tagged: <a href='http://ipggi.wordpress.com/tag/linux/'>Linux</a>, <a href='http://ipggi.wordpress.com/tag/poff/'>poff</a>, <a href='http://ipggi.wordpress.com/tag/point-to-point-tunneling-protocol/'>Point-to-Point Tunneling Protocol</a>, <a href='http://ipggi.wordpress.com/tag/pon/'>pon</a>, <a href='http://ipggi.wordpress.com/tag/pppd/'>pppd</a>, <a href='http://ipggi.wordpress.com/tag/pptp/'>pptp</a>, <a href='http://ipggi.wordpress.com/tag/pptp-linux/'>pptp-linux</a>, <a href='http://ipggi.wordpress.com/tag/pptpsetup/'>pptpsetup</a>, <a href='http://ipggi.wordpress.com/tag/raspberry-pi/'>Raspberry Pi</a>, <a href='http://ipggi.wordpress.com/tag/raspbian/'>raspbian</a>, <a href='http://ipggi.wordpress.com/tag/ubuntu/'>ubuntu</a>, <a href='http://ipggi.wordpress.com/tag/virtual-private-network/'>Virtual Private Network</a>, <a href='http://ipggi.wordpress.com/tag/vpn/'>vpn</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ipggi.wordpress.com/925/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ipggi.wordpress.com/925/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=925&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ipggi.wordpress.com/2013/02/19/using-a-point-to-point-tunnelling-protocol-virtual-private-network-pptp-vpn-client-on-a-raspberry-pi/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01aa96818e11d6d361d9832c957f8a0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ipggi</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/sudo-apt-get-install-pptp-linux.png" medium="image">
			<media:title type="html">sudo apt-get install pptp-linux</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/pptpsetup-help.png" medium="image">
			<media:title type="html">pptpsetup --help</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/pptpsetup-realworld.png" medium="image">
			<media:title type="html">pptpsetup realworld</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/cat-proxpnuk.png" medium="image">
			<media:title type="html">cat proxpnuk</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/ifconfig-s1.png" medium="image">
			<media:title type="html">ifconfig -s</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/pptpsetup-delete.png" medium="image">
			<media:title type="html">pptpsetup delete</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/pon-and-poff-h.png" medium="image">
			<media:title type="html">pon and poff -h</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/ifconfig-s.png" medium="image">
			<media:title type="html">ifconfig -s</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/sudo-pon-proxpnuk-updetach.png" medium="image">
			<media:title type="html">sudo pon proxpnuk updetach</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/pon-proxpnuk-dump-proxpnuk-debug-txt.png" medium="image">
			<media:title type="html">pon proxpnuk dump proxpnuk-debug.txt</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/tail-f-var-log-messages.png" medium="image">
			<media:title type="html">tail -f var log messages</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/traceroute-google-com-no-vpn1.png" medium="image">
			<media:title type="html">traceroute google.com no vpn</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/traceroute-google-com-no-route1.png" medium="image">
			<media:title type="html">traceroute google.com no route</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/route-add.png" medium="image">
			<media:title type="html">route add</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/traceroute-google-com-with-route.png" medium="image">
			<media:title type="html">traceroute google.com with route</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/nano-etc-rc-local.png?w=620" medium="image">
			<media:title type="html">nano etc rc.local</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2013/02/sudo-etc-rc-local1.png" medium="image">
			<media:title type="html">sudo etc rc.local</media:title>
		</media:content>
	</item>
		<item>
		<title>Ubuntu Linux Shell Tips Part I</title>
		<link>http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/</link>
		<comments>http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/#comments</comments>
		<pubDate>Thu, 13 Dec 2012 09:00:08 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[cat]]></category>
		<category><![CDATA[cd]]></category>
		<category><![CDATA[cut]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[head]]></category>
		<category><![CDATA[less]]></category>
		<category><![CDATA[ll]]></category>
		<category><![CDATA[ls]]></category>
		<category><![CDATA[man]]></category>
		<category><![CDATA[more]]></category>
		<category><![CDATA[nano]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tail]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wc]]></category>
		<category><![CDATA[whatis]]></category>

		<guid isPermaLink="false">http://ipggi.wordpress.com/?p=797</guid>
		<description><![CDATA[I love the Linux shell. While cryptic and horribly daunting for a first time user the text only command line offers an amazing amount of flexibility and power without the need to actually develop or code. Yet unlike a graphical user interface of which I don&#8217;t tend to like in Linux. The text shell is [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=797&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I love the Linux shell. While cryptic and horribly daunting for a first time user the text only command line offers an amazing amount of flexibility and power without the need to actually develop or code. Yet unlike a graphical user interface of which I don&#8217;t tend to like in Linux. The text shell is fast and allows you to remotely connect to a <a href="http://en.wikipedia.org/wiki/Headless_system">headless device</a> with the bare minimum of configuration.</p>
<p>Take the <a href="http://en.wikipedia.org/wiki/Raspberry_Pi">Raspberry Pi</a>, it only needs a plugged-in Ethernet cable and a micro-USB power cable. And this credit-card size computer can be controlled with Linux shell from your favourite Windows PC, Mac, <a href="https://itunes.apple.com/en/app/prompt/id421507115">tablet</a> or <a href="https://play.google.com/store/apps/details?id=org.connectbot">mobile phone</a>.</p>
<p>This series of entries is going to be a run-down of most of the useful Linux shell commands and configuration options that I use daily on my Linux boxes and images.</p>
<h2>Understanding the Prompt</h2>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/shell-prompt/" rel="attachment wp-att-868"><img class="alignnone size-full wp-image-868" alt="shell prompt" src="http://ipggi.files.wordpress.com/2012/09/shell-prompt.png?w=620"   /></a></p>
<p><code>ben@developers-tidbit:/$ _</code></p>
<p><code>ben</code> Is the logged in user.<br />
<code>@</code> At symbol.<br />
<code>developers-tidbit</code> Is the server name. On some systems the server&#8217;s IP address maybe listed.<br />
<code>:</code> Divider.<br />
<code>/</code> Is the current path. <code>~</code> Means the current path is the home directory.<br />
<code>$</code> Dollar states that the user is a standard user. It is replaced by a hash # if the user is a root administrator.<br />
<code>_</code> Is the cursor to show the point of keyboard input, text placement.</p>
<p>Linux supports auto-completion at prompt, so <code>cl [Tab] [Enter]</code> will finish the rest of the command <code>clear</code> and launch it for you. Auto-complete also works with directories, files and <code>apt-get</code> repositories. Everything in Linux is case-sensitive so this means <code>Clear</code>, <code>clear</code> and <code>CLEAR</code> are all treated as different commands.</p>
<p>The prompt also keeps a history of the previously used commands. The up and down arrow keys cycle through these.</p>
<h2>Directories</h2>
<p><code>cd</code> Changes the active directory.<br />
<code>cd /</code> Goes to the root of the file system. Like the <code>C:\</code> on a Windows system.<br />
<code>cd ~</code> Goes to your personal home directory.<br />
<code>cd /var</code> Goes into the directory <code>var</code>.</p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/cd-and-ls/" rel="attachment wp-att-871"><img class="alignnone  wp-image-871" alt="cd and ls" src="http://ipggi.files.wordpress.com/2012/09/cd-and-ls.png?w=720&#038;h=241" width="720" height="241" /></a></p>
<p><code>ls</code> Lists information about the files and is probably one of the more useful tools in the Linux toolbox.</p>
<p><code>ls</code> Lists the active directory.<br />
<code>ls /</code> List the root of the file system.<br />
<code>ls /var</code> List the content of the directory <code>/var</code>.<br />
<code>ls -l /</code> List the root of the file system using <a href="http://ipggi.wordpress.com/2012/07/01/linux-file-permissions-and-user-classes/">a long detail format</a>.</p>
<p><code>ll</code> Ubuntu has an alias (a short-cut) for the <code>ls -l</code> command.</p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/ll-var/" rel="attachment wp-att-876"><img class="alignnone size-medium wp-image-876" alt="ll var" src="http://ipggi.files.wordpress.com/2012/09/ll-var.png?w=300&#038;h=127" width="300" height="127" /></a></p>
<p><code>ls -lh /</code> Lists the root of the file system using a long detail format that humanises the file size.<br />
Alternatively <code>ll -h /</code> will display the same results.</p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/ll-var-humanised/" rel="attachment wp-att-877"><img class="alignnone size-medium wp-image-877" alt="ll var humanised" src="http://ipggi.files.wordpress.com/2012/09/ll-var-humanised.png?w=300&#038;h=127" width="300" height="127" /></a></p>
<p>To only list the directories of the active directory a hack will be required. It lists all the items returned by the <code>ls</code> command that end with a forward slash <code>/</code> directory tag.</p>
<p><code>ls -d */</code> List the directories of root.<br />
<code>ls -d /var/*/</code> Lists the directories of <code>/var</code>.</p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/list-only-directories/" rel="attachment wp-att-878"><img class="alignnone size-medium wp-image-878" alt="list only directories" src="http://ipggi.files.wordpress.com/2012/09/list-only-directories.png?w=300&#038;h=60" width="300" height="60" /></a></p>
<h2>Chaining Commands; Running Multiple Commands in Sequence</h2>
<p>The semicolon character <code>;</code> allows the running of multiple commands in a sequence. The following changes the active directory to home, lists the content using a detail list, then changes the active directory to root.</p>
<p><code>cd ~ ; ls -lh ; cd /</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/chained-commands/" rel="attachment wp-att-879"><img class="alignnone size-full wp-image-879" alt="chained commands" src="http://ipggi.files.wordpress.com/2012/09/chained-commands.png?w=620"   /></a></p>
<h2>Viewing Text Files</h2>
<p>Linux is highly dependant on plain text files for its configuration and settings so it would be natural that it includes many tools to handle these. The few common tools to display the content of a text file are <code>cat</code>, <code>more</code>, <code>less</code>.</p>
<p><code>cat</code> Is short for concatenate and prints the file on-screen.<br />
<code>more</code> Operates the same as <code>cat</code> except that it pauses the printing of the file at the end of each page.<br />
<code>less</code> Operates the same as <code>cat</code> except you can use the up / down arrow keys or the <code>Pg Up</code> / <code>Pg Down</code> keys to scroll through the document.<br />
To quit from both less and more press the <code>Q</code> key.</p>
<p><code>cat /etc/mime.type<br />
more /etc/mime.type<br />
less /etc/mime.type</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/more-mime-types/" rel="attachment wp-att-881"><img class="alignnone size-medium wp-image-881" alt="more mime-types" src="http://ipggi.files.wordpress.com/2012/09/more-mime-types.png?w=300&#038;h=36" width="300" height="36" /></a></p>
<p>To clean the screen use the <code>clear</code> command.</p>
<p>To display multiple files in a sequence more than one file can be supplied to <code>cat</code>.</p>
<p><code>cat file1 file2 file3</code></p>
<p>Another useful choice is the <code>-n</code> option that appends line numbers to the file in view.</p>
<p><code>cat -n /etc/mime.type</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/cat-line-numbers/" rel="attachment wp-att-882"><img class="alignnone size-medium wp-image-882" alt="cat line numbers" src="http://ipggi.files.wordpress.com/2012/09/cat-line-numbers.png?w=300&#038;h=77" width="300" height="77" /></a></p>
<p>To remove the display of double-line spacing use the <code>-s</code> option.</p>
<p>The head tool allows the partial display of a file.</p>
<p><code>head -n [number of lines to display]</code></p>
<p><code>head -n 29 /etc/mime.type</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/29-lines-of-mime-types/" rel="attachment wp-att-883"><img class="alignnone size-medium wp-image-883" alt="29 lines of mime-types" src="http://ipggi.files.wordpress.com/2012/09/29-lines-of-mime-types.png?w=300&#038;h=202" width="300" height="202" /></a></p>
<p>The use of a negative number will display the complete file except the last X lines.</p>
<p>The tail tool is the reverse of head, it displays the footer of a file.</p>
<p><code>tail -n 3 /etc/mime.type</code></p>
<p>Tail has as a really useful option that allows you to follow the most recent changes that have been append to a text file. This is an excellent tool for reading only the most recent entries in a large log file. You may need to press <code>Ctrl C</code> to exit <code>tail</code>.</p>
<p><code>cat /var/log/syslog<br />
clear<br />
tail -f /var/log/syslog</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/tail-f-syslog/" rel="attachment wp-att-884"><img class="alignnone size-medium wp-image-884" alt="tail f syslog" src="http://ipggi.files.wordpress.com/2012/09/tail-f-syslog.png?w=300&#038;h=105" width="300" height="105" /></a></p>
<p>Some configuration files such as the Linux user and group settings consist of comma-delimiter data. To extract data from these files you can use the <code>cut</code> tool. By default <code>cut</code> uses the tab character as a delimiter but this maybe changed with the <code>-d "[delimiter]"</code> option. The <code>-f</code> option with a list or a range of numbers provides the columns for display.</p>
<p><code>cut -d ":" -f "[columns]" [file]</code></p>
<p>Lists the first 3 columns in the group settings file.</p>
<p><code>cut -d ":" -f "1,2,3" /etc/group<br />
cut -d ":" -f "1-3" /etc/group<br />
cut -d ":" -f "1,2-3" /etc/group</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/cut-etc-group/" rel="attachment wp-att-885"><img class="alignnone size-medium wp-image-885" alt="cut etc group" src="http://ipggi.files.wordpress.com/2012/09/cut-etc-group.png?w=300&#038;h=89" width="300" height="89" /></a></p>
<p>To search within a file the <code>grep</code> tool is most useful.</p>
<p><code>grep "[search term]" [file]</code></p>
<p>A few grep options.<br />
<code>-i</code> Will ignore letter cases in the [search term], so <code>"Abc"</code>, <code>"abc"</code>, <code>"ABC"</code> will be considered matches for <code>grep "abc" [file]</code><br />
<code>-c</code> Returns a count of the number of search term matches rather than a summary of the finds.<br />
<code>-n</code> Includes line numbers in the summary of the finds.<br />
<code>-m [limit value]</code> Only returns the first X number of results.</p>
<p><code>grep -i "system v" /var/log/boot.log<br />
grep -in "system v" /var/log/boot.log<br />
grep -inm1 "system v" /var/log/boot.log<br />
grep -ic "system v" /var/log/boot.log</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/grep-example/" rel="attachment wp-att-886"><img class="alignnone size-medium wp-image-886" alt="grep example" src="http://ipggi.files.wordpress.com/2012/09/grep-example.png?w=300&#038;h=98" width="300" height="98" /></a></p>
<h2>In-built Help</h2>
<p>Linux shell has a number of help tools while you are in terminal. The quickest way to discover what a command&#8217;s purpose is the use of the <code>whatis</code> tool.</p>
<p><code>whatis more</code></p>
<p>Some terminal commands include a basic usage help which appears when you run the command with no options.</p>
<p><code>more</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/whatis/" rel="attachment wp-att-888"><img class="alignnone size-medium wp-image-888" alt="whatis" src="http://ipggi.files.wordpress.com/2012/09/whatis.png?w=300&#038;h=168" width="300" height="168" /></a></p>
<p>Many commands have an extended help which is trigged with the <code>--help</code> option.</p>
<p><code>whatis --help</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/help-long/" rel="attachment wp-att-887"><img class="alignnone size-medium wp-image-887" alt="help long" src="http://ipggi.files.wordpress.com/2012/09/help-long.png?w=300&#038;h=150" width="300" height="150" /></a></p>
<p>Finally most commands have usage manuals that are accessible at any time with the tool <code>man [command]</code>. Reading manuals through the terminal is pretty tedious so fortunately you can find these same texts online at <a href="http://manpages.ubuntu.com/manpages/">http://manpages.ubuntu.com/manpages/</a>. Use the website&#8217;s search box to find the tool&#8217;s manual.</p>
<p><code>man more</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/man-more/" rel="attachment wp-att-889"><img class="alignnone size-medium wp-image-889" alt="man more" src="http://ipggi.files.wordpress.com/2012/09/man-more.png?w=300&#038;h=202" width="300" height="202" /></a></p>
<p>Or read it at <a href="http://manpages.ubuntu.com/manpages/precise/en/man1/more.1.html">http://manpages.ubuntu.com/manpages/precise/en/man1/more.1.html</a></p>
<h2>Piping and Input/Output redirection</h2>
<p>This may sound a little abstract but it is easier to grasp when explained. Linux shell gives you the very powerful ability to take the output of one command and feed it into another.</p>
<p><code>ls --help</code></p>
<p>With the <code>ls --help</code> there is more text then what the terminal can display. A pipe using the <code>|</code> character will feed the output text into a secondary tool such as <code>less</code> or <code>more</code>. To exit either tool press the <code>Q</code> key.</p>
<p><code>ls --help | more<br />
ls --help | less</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/ls-help-with-more/" rel="attachment wp-att-890"><img class="alignnone size-medium wp-image-890" alt="ls help with more" src="http://ipggi.files.wordpress.com/2012/09/ls-help-with-more.png?w=300&#038;h=46" width="300" height="46" /></a></p>
<p>It’s not just help text that you can pipe. Any text output could be fed into another tool if it is supported.</p>
<p><code>ls -lh / | more</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/ls-with-more/" rel="attachment wp-att-891"><img class="alignnone size-medium wp-image-891" alt="ls with more" src="http://ipggi.files.wordpress.com/2012/09/ls-with-more.png?w=300&#038;h=46" width="300" height="46" /></a></p>
<p>Output text can also be saved to a file using the greater-than <code>&gt;</code> character. In the example below the output of <code>ls</code> is saved to <code>result.txt</code> that will be created in the Linux temporary directory.</p>
<p><code>ls -lh / &gt; /tmp/result.txt<br />
ls -l /tmp/result.txt</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/ls-saved-to-result-txt/" rel="attachment wp-att-892"><img class="alignnone size-medium wp-image-892" alt="ls saved to result.txt" src="http://ipggi.files.wordpress.com/2012/09/ls-saved-to-result-txt.png?w=300&#038;h=27" width="300" height="27" /></a></p>
<p><code>less /tmp/result.txt</code></p>
<p>The greater-than <code>&gt;</code> character will always overwrite an existing file with the new text content. Double greater-than <code>&gt;&gt;</code> will append the text to the end of the file.</p>
<p><code>echo "Hello world." &gt; /tmp/hi.txt<br />
cat /tmp/hi.txt<br />
echo "Test 1, 2, 3." &gt;&gt; /tmp/hi.txt<br />
cat /tmp/hi.txt</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/appending-text-example/" rel="attachment wp-att-893"><img class="alignnone size-medium wp-image-893" alt="appending text example" src="http://ipggi.files.wordpress.com/2012/09/appending-text-example.png?w=300&#038;h=76" width="300" height="76" /></a></p>
<p>The less-than <code>&lt;</code> character will redirect the file content into a command.</p>
<p><code>less &lt; /tmp/result.txt</code></p>
<h2>Easy Text editing</h2>
<p>To edit text files from Linux shell I believe the easiest to use tool is <code>nano</code>.</p>
<p><code>nano /tmp/hi.txt</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/nano-editing-hi-txt/" rel="attachment wp-att-894"><img class="alignnone size-medium wp-image-894" alt="nano editing hi.txt" src="http://ipggi.files.wordpress.com/2012/09/nano-editing-hi-txt.png?w=300&#038;h=65" width="300" height="65" /></a></p>
<p>Like in <code>less </code>you can use the arrow keys or <code>Pg Up</code> / <code>Pg Down</code> to scroll through the text. The left and right arrow keys can reposition the cursor. Any text typed will be inserted at active position of the cursor.</p>
<p>To cut a line of text press <code>F9</code>.<br />
To cut a paragraph of text use <code>F9</code> multiple times.<br />
To paste text press <code>F10</code>.<br />
To go to row position press <code>Ctrl _</code>.<br />
For a help that unfortunately is slightly cryptic press <code>Ctrl G</code>. In the help text the <code>^</code> symbol means the <code>Ctrl</code> key while the <code>M-</code> symbol means <code>Alt</code> key.</p>
<p>To exit <code>nano </code>press <code>Ctrl X</code>.</p>
<p>When you exit <code>nano </code>you will be asked to <em>Save modified butter (ANSWERING &#8220;No&#8221; WILL DESTROY CHANGES) ?</em> To save the changes to file type <code>y </code>otherwise type <code>n </code>and the file will remain unedited and any changes lost.</p>
<p>Piping output text into <code>nano </code>doesn’t work as expected.</p>
<p><code>ls -lh / | nano</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/ls-to-nano-error/" rel="attachment wp-att-909"><img class="alignnone size-full wp-image-909" alt="ls to nano error" src="http://ipggi.files.wordpress.com/2012/09/ls-to-nano-error.png?w=620"   /></a></p>
<p>Nano expects to read text sourced from a file. To force <code>nano </code>to read text from standard input (aka stdin which is the Linux term for piped or streamed text) a dash <span style="font-family:monospace;">-</span> is used for the input file name.</p>
<p><code>ls -ln / | nano -</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/ls-output-in-nano/" rel="attachment wp-att-898"><img class="alignnone size-medium wp-image-898" alt="ls output in nano" src="http://ipggi.files.wordpress.com/2012/09/ls-output-in-nano.png?w=300&#038;h=208" width="300" height="208" /></a></p>
<p>To get some basic statistics of a text file the <code>wc</code> word count tool is useful. <code>wc</code> without any options displays the number of lines, words and the byte count for the file. The <code>-w</code> option counts the words, the <code>-m</code> counts the number of characters while the <code>-l</code> counts the number of lines.</p>
<p><code>wc /proc/cpuinfo<br />
wc -w /proc/cpuinfo<br />
wc -m /proc/cpuinfo<br />
wc -l /proc/cpuinfo</code></p>
<p><a href="http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/wc-cpuinfo/" rel="attachment wp-att-899"><img class="alignnone size-medium wp-image-899" alt="wc cpuinfo" src="http://ipggi.files.wordpress.com/2012/09/wc-cpuinfo.png?w=300&#038;h=116" width="300" height="116" /></a></p>
<p>That is the end of Part I of my Linux shell tips. The 2nd part that will be online at a later date will cover administration, file, network system and user tools.</p>
<br />Filed under: <a href='http://ipggi.wordpress.com/category/linux/'>Linux</a>, <a href='http://ipggi.wordpress.com/category/server-2/'>Server</a> Tagged: <a href='http://ipggi.wordpress.com/tag/cat/'>cat</a>, <a href='http://ipggi.wordpress.com/tag/cd/'>cd</a>, <a href='http://ipggi.wordpress.com/tag/cut/'>cut</a>, <a href='http://ipggi.wordpress.com/tag/grep/'>grep</a>, <a href='http://ipggi.wordpress.com/tag/head/'>head</a>, <a href='http://ipggi.wordpress.com/tag/less/'>less</a>, <a href='http://ipggi.wordpress.com/tag/ll/'>ll</a>, <a href='http://ipggi.wordpress.com/tag/ls/'>ls</a>, <a href='http://ipggi.wordpress.com/tag/man/'>man</a>, <a href='http://ipggi.wordpress.com/tag/more/'>more</a>, <a href='http://ipggi.wordpress.com/tag/nano/'>nano</a>, <a href='http://ipggi.wordpress.com/tag/prompt/'>prompt</a>, <a href='http://ipggi.wordpress.com/tag/shell/'>shell</a>, <a href='http://ipggi.wordpress.com/tag/tail/'>tail</a>, <a href='http://ipggi.wordpress.com/tag/ubuntu/'>ubuntu</a>, <a href='http://ipggi.wordpress.com/tag/wc/'>wc</a>, <a href='http://ipggi.wordpress.com/tag/whatis/'>whatis</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ipggi.wordpress.com/797/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ipggi.wordpress.com/797/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=797&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ipggi.wordpress.com/2012/12/13/ubuntu-linux-shell-tips-part-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01aa96818e11d6d361d9832c957f8a0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ipggi</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/shell-prompt.png" medium="image">
			<media:title type="html">shell prompt</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/cd-and-ls.png" medium="image">
			<media:title type="html">cd and ls</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/ll-var.png?w=300" medium="image">
			<media:title type="html">ll var</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/ll-var-humanised.png?w=300" medium="image">
			<media:title type="html">ll var humanised</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/list-only-directories.png?w=300" medium="image">
			<media:title type="html">list only directories</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/chained-commands.png" medium="image">
			<media:title type="html">chained commands</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/more-mime-types.png?w=300" medium="image">
			<media:title type="html">more mime-types</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/cat-line-numbers.png?w=300" medium="image">
			<media:title type="html">cat line numbers</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/29-lines-of-mime-types.png?w=300" medium="image">
			<media:title type="html">29 lines of mime-types</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/tail-f-syslog.png?w=300" medium="image">
			<media:title type="html">tail f syslog</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/cut-etc-group.png?w=300" medium="image">
			<media:title type="html">cut etc group</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/grep-example.png?w=300" medium="image">
			<media:title type="html">grep example</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/whatis.png?w=300" medium="image">
			<media:title type="html">whatis</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/help-long.png?w=300" medium="image">
			<media:title type="html">help long</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/man-more.png?w=300" medium="image">
			<media:title type="html">man more</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/ls-help-with-more.png?w=300" medium="image">
			<media:title type="html">ls help with more</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/ls-with-more.png?w=300" medium="image">
			<media:title type="html">ls with more</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/ls-saved-to-result-txt.png?w=300" medium="image">
			<media:title type="html">ls saved to result.txt</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/appending-text-example.png?w=300" medium="image">
			<media:title type="html">appending text example</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/nano-editing-hi-txt.png?w=300" medium="image">
			<media:title type="html">nano editing hi.txt</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/ls-to-nano-error.png" medium="image">
			<media:title type="html">ls to nano error</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/ls-output-in-nano.png?w=300" medium="image">
			<media:title type="html">ls output in nano</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/09/wc-cpuinfo.png?w=300" medium="image">
			<media:title type="html">wc cpuinfo</media:title>
		</media:content>
	</item>
		<item>
		<title>MAME Arcade Game Fun With A Raspberry Pi</title>
		<link>http://ipggi.wordpress.com/2012/11/26/mame-arcade-game-fun-with-a-raspberry-pi/</link>
		<comments>http://ipggi.wordpress.com/2012/11/26/mame-arcade-game-fun-with-a-raspberry-pi/#comments</comments>
		<pubDate>Mon, 26 Nov 2012 04:00:19 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[MAME]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[AdvanceMAME]]></category>
		<category><![CDATA[AdvanceMenu]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[auto-launch]]></category>
		<category><![CDATA[auto-login]]></category>
		<category><![CDATA[auto-start]]></category>
		<category><![CDATA[iMAME]]></category>
		<category><![CDATA[Moebius]]></category>
		<category><![CDATA[ROM]]></category>
		<category><![CDATA[sftp]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://ipggi.wordpress.com/?p=805</guid>
		<description><![CDATA[To avoid confusion please note that this entry has been updated in May of 2013. Some of the screen captures show older versions of Moebius and AdvMAME in use. This tutorial is a step-by-step walk through on getting MAME running on a Raspberry Pi. This guide is from November 2012 and parts of it maybe [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=805&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><ins datetime="2013-05-06T01:13:25+00:00">To avoid confusion please note that this entry has been updated in May of 2013. Some of the screen captures show older versions of Moebius and AdvMAME in use.</ins></p>
<p>This tutorial is a step-by-step walk through on getting MAME running on a Raspberry Pi. This guide is from November 2012 and parts of it maybe out of date if you are reading it at a later time. As of writing, software, operating systems and drivers for the Pi is quite young and constantly evolving so some of the solutions used here I consider as hacks and are not best practise.</p>
<p>The goal of this tutorial is to run a cut down, bare bones operating system and to create an image thats sole purpose is to run MAME arcade ROMs. The tutorial is written with a Windows user in mind but would also be useful for new Raspberry Pi owners who are not familiar or comfortable with the Linux shell.</p>
<p><ins datetime="2013-01-03T02:11:36+00:00">January 2013: About a month after publishing this article Shea Silverman released <a href="http://blog.sheasilverman.com/pimame-raspberry-pi-os-download/">PiMAME an all-in-one MAME solution for the Raspberry Pi</a> based on Raspbian. If you want a ready, out of the box solution I recommend it. If you prefer to hack and customise your own MAME setup or to learn about the Linux shell on your Pi then please read on.</ins></p>
<p>Firstly some jargon used in this tutorial.</p>
<ul>
<li>MAME Is a piece of software that emulates the hardware of legacy <a class="vt-p" href="http://en.wikipedia.org/wiki/Arcade_game">arcade video games</a>. <a class="vt-p" href="http://en.wikipedia.org/wiki/MAME">http://en.wikipedia.org/wiki/MAME</a></li>
<li>Image Is a copy of a computer&#8217;s file system that is kept in a single file for easy storage and duplication.</li>
<li>ROM Is like an image but it is a copy of the software used to power arcade video games.</li>
<li>SD card Is a memory card used as storage for portable devices such as cameras, phones and the Raspberry Pi.</li>
<li>ARM Is the type of CPU used by the Raspberry Pi, it is incompatible with software written for x86 processors such as those used in most desktops and laptops.</li>
<li>Shell Is a text only interface that allows you to run programs and interact with the computer.</li>
</ul>
<p>The hardware I used.</p>
<ul>
<li><a class="vt-p" href="http://www.shintaro.com.au/products/07_card_readers/external/SH-11IN1/index.php">SD to USB card reader.</a></li>
<li><a class="vt-p" href="http://www.newegg.com/Product/Product.aspx?Item=N82E16812189164">Micro-USB to USB cable</a>.</li>
<li><a class="vt-p" href="http://www.newegg.com/Product/Product.aspx?Item=N82E16812200119">Flat Ethernet cable.</a></li>
<li>USB keyboard.</li>
<li>USB arcade joystick. <a class="vt-p" href="http://sdtekken.wordpress.com/tech-area/arcade-sticks/elecom-jc-as01bk-arcade-stick/">I have an old Elecom JC-AS01BK Arcade Stick.</a></li>
<li><a class="vt-p" href="http://www.element14.com/community/groups/raspberry-pi">Raspberry Pi Model B with 256<ins datetime="2013-01-15T00:16:05+00:00">MB</ins> RAM.</a></li>
<li><a class="vt-p" href="http://www.sandisk.com/products/memory-cards/sd/standard-class4/?capacity=8GB">SanDisk SDHC 4 MB/sec 8GB card.</a> You will need at least a 1GB card SD card for this project.</li>
</ul>
<h2>Choosing a Minimal Raspberry Pi Operating System</h2>
<p>As mentioned before I want a bare bones operating system. There is no need for a graphical user interface or unnecessary development bloat as our Pi image has a singular purpose.</p>
<p>On searching the internet I know of a few options. The official downloads <a class="vt-p" href="http://www.raspberrypi.org/">http://www.raspberrypi.org</a> offer <a class="vt-p" href="http://www.raspbian.org/">Raspbian</a> and <a class="vt-p" href="https://www.archlinux.org/">Arch Linux</a>. Raspbian has too much bloat for our purpose, while Arch Linux for the ARM processor lacks software support.</p>
<p>Fortunately there is the little known Moebius Linux, a minimal Raspbian based distribution targeted for the Raspberry Pi. The Moebius website is at <a class="vt-p" href="http://moebiuslinux.sourceforge.net">http://moebiuslinux.sourceforge.net</a> while the download page is <a class="vt-p" href="http://sourceforge.net/projects/moebiuslinux/files/raspberry.stable">http://sourceforge.net/projects/moebiuslinux/files/raspberry.stable</a>.</p>
<p>If you&#8217;re familiar with your Raspberry Pi and know how to transfer images to SD cards. Download and transfer the Moebius <del datetime="2013-05-06T01:13:25+00:00"><code>moebius.minimal.image.1.0.1</code></del> <ins datetime="2013-05-06T01:13:25+00:00"><code>moebius-1.1.0</code></ins> image to your SD card, use it to boot your Raspberry Pi and read on. If that makes little sense <a class="vt-p" href="http://ipggi.wordpress.com/2012/11/24/mame-arcade-game-fun-with-a-raspberry-pi-beginner-supplimental/">please follow my supplemental article</a>.</p>
<h2><a class=" vt-p" id="firstboot"></a>First Boot And Hardware Configuration</h2>
<p>Make sure your Pi has a keyboard attached, a connection to a LCD monitor or TV and an Ethernet link to the internet. Power the device using the micro-USB cable.</p>
<p>Once booted you should be taken to the Moebius <em>Main Configuration</em> program.</p>
<p><a href="http://ipggi.files.wordpress.com/2012/11/moebius-1-1-0-main-configuration.png"><img class=" wp-image-1122 alignnone" alt="moebius 1.1.0 main configuration" src="http://ipggi.files.wordpress.com/2012/11/moebius-1-1-0-main-configuration.png?w=300&#038;h=168" width="300" height="168" /></a></p>
<p>First thing you should always do is change the default password by selecting <em>Password</em>.</p>
<p>You will want to run the <em>AutoResize</em> tool as only 850 MB of your SD card is in use by Moebius, and you may run out of available space using MAME.</p>
<p>The <em>MemorySetup</em> should be changed to the lowest value of <em>16Mb for VideoCore</em>. This will set 16 MB of system memory to your GPU (graphics processor unit) instead of the default 128 MB. MAME does not use 3D graphics or video hardware acceleration which are the main benefactors of GPU memory.</p>
<p>Also take note of the <em>Overclock</em> which will use hardware tweaks to speed up your Pi. The downside of overclocking is it could shorten the life the Pi&#8217;s chip components. This might be an issue if you have a first release Pi that could become a collectors&#8217; item in the future.</p>
<p>Once done, select <em>Finish</em>. You maybe rebooted, if so re-login as root.</p>
<h2>Remote Login</h2>
<p>Using <a class="vt-p" href="http://en.wikipedia.org/wiki/Secure_Shell">Secure Shell</a> you can remote login to your Pi from your PC. You can operate the Pi without the need for a plugged in keyboard or display. In addition it allows you copy and paste text from your PC to the Pi. Remote login is already active in Moebius so you just need a Windows SSH client to connect to the Pi.</p>
<p>I would recommend Putty for a quick and easy solution. You can download it from <a class="vt-p" href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html</a>. You only need <em>Putty.exe</em> from the <em>Binaries download for Windows on Intel x86</em>. It is a stand-alone portable application so you can copy and run it from to your <code>Raspberry Pi</code> directory on your PC.</p>
<p>We need the numeric ip or inet address of the Pi which is its unique identifier when connected to your home network.</p>
<p><code>hostname -I</code> (note the capital i)</p>
<p>My Pi&#8217;s address is highlighted as the yellow text and is <code>192.168.1.8</code>.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/hostname-i.png"><img class="alignnone size-full wp-image-834" title="hostname i" alt="" src="http://ipggi.files.wordpress.com/2012/11/hostname-i.png?w=620"   /></a></p>
<p>On your PC launch the Putty application. At the <em>Startup configuration screen</em> enter the Pi&#8217;s address as the <em>Host Name (or IP address)</em>. Make sure the <em>Port</em> is a value of <code>22</code> and that the <em>Connection Type</em> is <code>SSH</code>. Under <em>Saved Sessions</em> give it a name such as <code>Raspberry Pi</code>. Press the <em>Save</em> button.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/setting-up-putty-for-a-connection1.png"><img class="alignnone size-medium wp-image-835" title="setting up putty for a connection" alt="" src="http://ipggi.files.wordpress.com/2012/11/setting-up-putty-for-a-connection1.png?w=300&#038;h=289" width="300" height="289" /></a></p>
<p>To connect to your Pi press the <em>Open</em> button. If prompted press <em>Yes</em> to automatically trust future connections to the Pi device and then login with your <code>root</code> account. You should be remotely connected to the Pi via your PC. If you want to copy clipboard text from the PC to the Pi just right-mouse click the Putty text window. To copy text from your Pi, left-mouse click and hold to select the text, it is then copied to your PC&#8217;s clipboard.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/putty-copying-text-to-the-clipboard.png"><img class="alignnone size-medium wp-image-841" title="putty copying text to the clipboard" alt="" src="http://ipggi.files.wordpress.com/2012/11/putty-copying-text-to-the-clipboard.png?w=300&#038;h=77" width="300" height="77" /></a></p>
<p>If you&#8217;re new to the Linux shell try out some of the commands below.</p>
<h2>Some Useful Shell Tools</h2>
<p><code>df -h --total</code> Lists the Size, Used and Available disk space on your SD card.<br />
<code>free -th</code> Lists the system memory (RAM) usage.<br />
<code>top</code> Lists CPU processor usage and active memory usage. To quit press <code>Q</code>.<br />
<code>ping -c 3 <a href="http://www.google.com" rel="nofollow">http://www.google.com</a></code> To check to see that the Pi has a working internet connection.<br />
<code>cd ~</code> Takes you to your user home directory.<br />
<code>cd /</code> Takes you to the file system root.<br />
<code>ls</code> Lists files and directories of the active directory.<br />
<code>ls -l</code> Lists them in a detailed format.<br />
<code>ls -l -color</code> Lists them using colour coding.<br />
<code>reboot</code> Reboots your Pi.<br />
<code>shutdown -hP 0</code> Shuts down and turns off your Pi. Note the zero.<br />
<code>cat</code> Displays the content for a file. Example <code>cat /etc/passwd</code> displays the user list of the Pi. If you need to exit cat press <code>[Ctrl] C</code>.<br />
<code>clear</code> will clear the screen.</p>
<p>Don&#8217;t forget you can use auto-completion in Linux, so <code>moe [Tab]</code> <code>[Enter]</code> will finish the rest of the command <code>moebius.config</code> and launch it for you. Auto-complete also works with directories, files and apt-get repositories. Everything in Linux is case-sensitive so this means <code>Moebius.config</code>, <code>moebius.config</code> and <code>moebius.Config</code> are all treated as different applications.</p>
<h2>Software Update</h2>
<p>Assuming your Pi is connected to the Internet we should update the Moebius software repositories and then its applications. This could be thought of as the Linux equivalent of Windows Update.</p>
<p><code>apt-get update</code><br />
<code>apt-get upgrade -y</code></p>
<h2>Shell Customisations</h2>
<p>Moebius uses the Bourne compatible (<code>/bin/sh</code>) Bash shell (<code>/bin/bash</code>). I apply some customisations to help make its usage a little more useful with a Pi. Most of your system settings are in plain text files stored in <code>/etc/</code>. Whenever you make a change to a file within here I recommend making a copy of the original so you can restore it if needed. Enter the settings directory, backup and then edit the Bash system-wide file.</p>
<p><code>cd /etc/</code><br />
<code>nano -B bash.bashrc</code></p>
<p>Nano is my recommended text file editor, the <code>-B</code> argument automatically backups the source file. <code>bash.bashrc</code> is the file name of the file we are editing. In Nano use the <code>[down-arrow]</code> key or <code>[PnDn]</code> to scroll to the end of the file and add the following if you wish. At the bottom of the file add the following though it is probably best if you copy the code and paste using a Putty SSH connection.</p>
<p><code># Alias definitions.</code><br />
<code># You may want to put all your additions into a separate file like</code><br />
<code># /etc/bash_aliases, instead of adding them here directly.</code><br />
<code># See /usr/share/doc/bash-doc/examples in the bash-doc package.</code><br />
<code><br />
if [ -f /etc/bash_aliases ]; then<br />
. /etc/bash_aliases<br />
fi</code></p>
<p>Now create the file <code>bash_aliases</code> that will be used to hold our customisations.</p>
<p><code>nano /etc/bash_aliases</code></p>
<p>Copy and paste the following code into Nano.</p>
<p><code>#!/bin/sh</p>
<p># Alias definitions.<br />
# You may want to put all your additions in here.<br />
# See /usr/share/doc/bash-doc/examples in the bash-doc package.</p>
<p># Enable color support<br />
if [ -x /usr/bin/dircolors ]; then<br />
test -r ~/.dircolors &amp;&amp; eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"<br />
alias ls='ls --color=auto'<br />
alias grep='grep --color=auto'<br />
alias fgrep='fgrep --color=auto'<br />
alias egrep='egrep --color=auto'<br />
fi</p>
<p># Extra ls aliases<br />
alias ll='ls -FAl'<br />
alias la='ls -FA'<br />
alias l='ls -FAoh'</p>
<p># Raspberry Pi Aliases<br />
alias raspi-audio="/usr/bin/alsamixer"<br />
alias raspi-cpu="/bin/cat /proc/cpuinfo"<br />
alias raspi-disk="/bin/df -h --total"<br />
alias raspi-firmware="/opt/vc/bin/vcgencmd version"<br />
alias raspi-mem="/usr/bin/free -th"<br />
alias raspi-ip="/bin/hostname -I"<br />
alias raspi-ping="/bin/ping -c 3 <a href="http://www.google.com" rel="nofollow">http://www.google.com</a>"<br />
alias raspi-reboot="/sbin/reboot"<br />
alias raspi-shutdown="/sbin/shutdown -Ph 0"<br />
alias raspi-update="/usr/bin/apt-get update -y;/usr/bin/apt-get upgrade -y"<br />
alias raspi-version="/bin/cat /proc/version"</code></p>
<p>Once done press <code>[Ctrl] X</code> to exit, answer <code>Y</code> to the <em>Save modified buffer</em> question and press <code>[Enter]</code> to leave as is the <em>File Name to Write [Backup]</em> prompt.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/nano-profile-edit1.png"><img class="alignnone size-medium wp-image-846" title="nano profile edit" alt="" src="http://ipggi.files.wordpress.com/2012/11/nano-profile-edit1.png?w=300&#038;h=170" width="300" height="170" /></a></p>
<p>If you try one of the new aliases it will return an error.</p>
<p><code>ll</code><br />
<code>-bash: ll: command not found error.</code></p>
<p>Run the source command to apply the changes and then retry the ll alias.</p>
<p><code>source /etc/bash.bashrc</code><br />
<code>ll</code></p>
<p>The <code>ll</code> alias should now work and be treated as just another command. Another quick tip, you can pipe the output of one command into another.</p>
<p><code>ll | less</code></p>
<p><code>less</code> allows you to use the arrows or the <code>[PgUp] [PgDn]</code> keys to scroll through the output of <code>ll</code>. To exit press <code>Q</code>.</p>
<p>You can read more on customising profiles at <a class="vt-p" href="http://www.hypexr.org/bash_tutorial.php">http://www.hypexr.org/bash_tutorial.php</a>.</p>
<h2>MAME Time</h2>
<p>As mentioned at the start of this article MAME is a complex piece of software that emulates antiquated video arcade machines to trick embedded game software into thinking they are running on original hardware.</p>
<p>As MAME is open-source and has been a working project since 1997 it comes in many different flavours for many operating systems. The official MAME project is for modern Microsoft Windows PCs with emulation accuracy a more prioritised goal than emulation speed. That means ports of the current versions of MAME are not suited for low and underpowered devices such as the Raspberry Pi.</p>
<p>AdvanceMAME is a MAME port that is for custom, embedded hardware and is perfect for our use. The most recent AdvanceMAME version is 1.2 which is compatible with ROMS packaged for MAME version 0.106 that came out in July 2006. This is important to note as the official MAME build as of May 2013 is version 0.148. So ROMS that work on your PC edition of MAME may not work on your Pi.</p>
<p>There is also an alternative Pi port of MAME based on the <a class="vt-p" href="http://imame.mameworld.info/">iMAME code-base</a> which first came out for the <a class="vt-p" href="http://en.wikipedia.org/wiki/IPAQ">HP Ipaq colour PDA</a> back in 2001! The age of its code base and the ancient MAME 0.37 ROM support means it is best avoided.</p>
<p>Shea Silverman at <a class="vt-p" href="http://blog.sheasilverman.com/tag/mame/">http://blog.sheasilverman.com/tag/mame/</a> has compiled a Raspberry Pi Raspian port of AdvanceMAME. Download it to your root home directory. Install it using the Debian package management program.</p>
<p><code>cd ~</code><br />
<code>wget <a href="http://sheasilverman.com/rpi/raspbian/debs/advancemame_1.2-1_armhf.deb" rel="nofollow">http://sheasilverman.com/rpi/raspbian/debs/advancemame_1.2-1_armhf.deb</a></code><br />
<code>dpkg -i advancemame_1.2-1_armhf.deb</code></p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/installing-advancemame1.png"><img class="alignnone size-medium wp-image-848" title="installing advancemame" alt="" src="http://ipggi.files.wordpress.com/2012/11/installing-advancemame1.png?w=300&#038;h=170" width="300" height="170" /></a></p>
<p>Fetch the software dependencies needed by AdvanceMAME that Moebius is missing.</p>
<p><code>apt-get -y install libsdl1.2debian libfreetype6</code></p>
<p>Run AdvanceMAME for the first time.</p>
<p><code>advmame</code></p>
<p>A configuration file <code>advmame.rc</code> is placed in the <code>/root/.advance/</code> directory. The file holds a huge list of default settings. Backup and then edit this file with Nano.</p>
<p><code>cd /root/.advance/</code><br />
<code>cp advmame.rc advmame.rc~</code><br />
<code>nano advmame.rc</code></p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/advmame-first-time.png"><img class="alignnone size-medium wp-image-849" title="advmame first time" alt="" src="http://ipggi.files.wordpress.com/2012/11/advmame-first-time.png?w=300&#038;h=77" width="300" height="77" /></a></p>
<p>Change the following settings.</p>
<p><code>device_mouse none</code><br />
<code>misc_freeplay yes</code><br />
<code>misc_quiet yes</code><br />
<code>record_sound no</code><br />
<code>record_video no</code></p>
<p><em>device_mouse</em> turns off mouse support.<br />
<em>record_sound</em> and <em>record_video</em> turns off both recording functionality which is not suited to the Pi.<br />
<em>misc_freeplay</em> turns the free-play mode switch on if a game supports it.<br />
<em>misc_quiet</em> turns off the annoying start-up copyright message.</p>
<p>If the Pi is connected to a HDMI TV or monitor add the following to your settings.<br />
<code>device_video_clock 5 - 50 / 15.62 / 50 ; 5 - 50 / 15.73 / 60</code></p>
<p>For Pi&#8217;s using a HDMI to VGA converter this setting worked well for me.<br />
<code>device_video_clock 5 - 50 / 15.75 / 50</code></p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/added-device_video_clock1.png"><img class="alignnone size-medium wp-image-853" title="added device_video_clock" alt="" src="http://ipggi.files.wordpress.com/2012/11/added-device_video_clock1.png?w=300&#038;h=170" width="300" height="170" /></a></p>
<p>If you&#8217;re using the yellow composite connection get your <code>device_video_clock</code> value from the AdvanceMAME install document <a class="vt-p" href="http://advancemame.sourceforge.net/doc-install.html#4.5">http://advancemame.sourceforge.net/doc-install.html#4.5</a>. If you are not sure what analogue TV system your country uses try here <a class="vt-p" href="http://countrycode.org/tv-standards">http://countrycode.org/tv-standards</a>.</p>
<p>Finally you may also want to tweak the audio with the <code>sound_samplerate</code> setting. This sets the audio quality output and I imagine could improve the performance of a game if lowered. The default value is <code>44100</code> but poorer quality values of <code>22050</code> and <code>11025</code> are permitted.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/sound_samplerate.png"><img class="alignnone size-full wp-image-851" title="sound_samplerate" alt="" src="http://ipggi.files.wordpress.com/2012/11/sound_samplerate.png?w=620"   /></a></p>
<p>A detailed list of all the settings used by advmame.rc is in the AdvanceMAME documentation <a class="vt-p" href="http://advancemame.sourceforge.net/doc-advmame.html#8">http://advancemame.sourceforge.net/doc-advmame.html#8</a>.</p>
<p>Save changes to advmame.rc and exit Nano.</p>
<h2>MAME ROMs And Launch</h2>
<p>MAME by itself is pretty useless. To get any fun or functionality you need ROM images of the game programs that are found in the arcade machines. A legal collection of free for non-commercial use ROMs is available at the <a class="vt-p" href="http://mamedev.org/roms/">MAMEDev site</a>.</p>
<p>Your ROMs can go in either the <code>/root/.advance/rom/</code> or the <code>/usr/local/share/advance/rom/</code> directories. I would recommend the <code>/usr/local/share/advance/rom/</code> directory for greater flexibily. I download and then test the copy of AdvanceMAME with the <a class="vt-p" href="http://www.mamedb.com/game/victory">1982 arcade game Victory by Exidy</a>.</p>
<p><code>cd /usr/local/share/advance/rom/</code><br />
<code>wget <a href="http://mamedev.org/roms/victory/victory.zip" rel="nofollow">http://mamedev.org/roms/victory/victory.zip</a> -U Firefox</code><br />
<code>advmame victory</code></p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/advmame-victory.png"><img class="alignnone size-medium wp-image-852" title="advmame victory" alt="" src="http://ipggi.files.wordpress.com/2012/11/advmame-victory.png?w=300&#038;h=108" width="300" height="108" /></a></p>
<p>Make sure you do not run <code>advmame victory</code> in a SSH shell or a Putty connection as it will not work. At start-up you will experience a period of colour cycles, this is the legacy arcade software testing the hardware at power-on. At the <em>Diagnostic Test Failure Screen</em> press the <code>1</code> key. Congratulations you have a MAME game running on your Raspberry Pi!</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/diagnostic-testing-failure.jpg"><img class="alignnone size-medium wp-image-855" title="diagnostic testing failure" alt="" src="http://ipggi.files.wordpress.com/2012/11/diagnostic-testing-failure.jpg?w=300&#038;h=199" width="300" height="199" /></a></p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/victory-title-screen.jpg"><img class="alignnone size-medium wp-image-854" title="victory title screen" alt="" src="http://ipggi.files.wordpress.com/2012/11/victory-title-screen.jpg?w=300&#038;h=199" width="300" height="199" /></a></p>
<p>To bring up the MAME menu press <code>[Tab]</code>.<br />
To insert coins press the <code>5</code> key.<br />
To start as player 1 after inserting a coin press the <code>1</code> key.<br />
To exit MAME and return to Linux press <code>[Esc]</code>.</p>
<h2>Transfer Files From Your PC To Your Pi (optional).</h2>
<p>Now that you have a running MAME device you may want to transfer files to the Pi from your PC. There are a couple of options available but I use SSH&#8217;s secure file transfer or SFTP. Its set-up is painless, near automatic and gives full access to the Pi&#8217;s file system if it is wanted. On the Windows side of things I use <a class="vt-p" href="http://filezilla-project.org/">FileZilla Client</a>, a free and open-source file transfer application.</p>
<p>On the Pi install openssh-server and fetch its IP address.</p>
<p><code>apt-get install -y openssh-server</code><br />
<code>hostname -I</code></p>
<p>Your Pi should be ready to receive incoming SFTP connections.</p>
<p><a class="vt-p" href="http://filezilla-project.org/download.php?type=client">Download, install</a>, launch FileZilla Client on the PC and fill in its <em>Quickconnect bar</em> and press the <em>Quickconnect</em> button.</p>
<p><em>Host:</em> Is the Pi&#8217;s IP address returned by hostname -I,<br />
<em>Username:</em> <code>root</code><br />
<em>Password:</em> Is your root account password.<br />
<em>Port:</em> <code>22</code></p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/filezilla-quickconnect.png"><img class="alignnone size-medium wp-image-856" title="filezilla quickconnect" alt="" src="http://ipggi.files.wordpress.com/2012/11/filezilla-quickconnect.png?w=300&#038;h=44" width="300" height="44" /></a></p>
<p>The left <em>Local site:</em> pane is the file system on your PC, the right <em>Remote site:</em> is your Pi. You can browse through directories on either. To transfer files to the Pi, simply select and right-click, <em>Upload</em>. If you want to upload ROMs it is best that you first navigate the <em>Remote site</em> directory to <code>/root/.advance/rom/</code> or <code>/usr/local/share/advance/rom/</code>.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/filezilla-quickhelp.png"><img class="alignnone size-medium wp-image-857" title="filezilla quickhelp" alt="" src="http://ipggi.files.wordpress.com/2012/11/filezilla-quickhelp.png?w=300&#038;h=212" width="300" height="212" /></a></p>
<h2>Start MAME At Boot (optional)</h2>
<p>To have a true portable arcade device you need the Pi to login and launch MAME automatic without the need for a keyboard or user input.</p>
<p>To auto-login as root with no user login or password prompt, backup and edit the initialisation process settings.</p>
<p><code>cd /etc/</code><br />
<code>cp inittab inittab~</code><br />
<code>nano +54 inittab</code></p>
<p>Replace</p>
<p><code>1:2345:respawn:/sbin/getty --noclear 38400 tty1</code></p>
<p>with</p>
<p><code>1:2345:respawn:/sbin/getty -a root --noclear 38400 tty1</code><br />
<code>#1:2345:respawn:/sbin/getty --noclear 38400 tty1</code></p>
<p>Save changes to <code>inittab</code> and exit Nano.</p>
<p>To auto-launch AdvanceMAME we need to set-up the root account to use the file <code>.profile</code> to run a custom Bash launch script after login.</p>
<p><code>cp /usr/share/base-files/dot.profile /root/.profile</code><br />
<code>cd /root/</code><br />
<code>nano .bashrc</code></p>
<p>In <code>.bashrc</code> add the following to auto-start AdvanceMame and save your changes. The <code>echo</code> command displays text on-screen while the <code>&amp;&amp;</code> characters creates a new line. Hashes <code>#</code> are used to ignore lines in a script which makes them useful for programming comments.</p>
<p><code># /root/.bashrc: executed by bash(1) for root shells.</p>
<p>if [ -z "$SSH_CONNECTION" ]; then<br />
# Launch AdvanceMAME with a ROM<br />
echo &amp;&amp; echo "Starting AdvanceMAME" &amp;&amp; echo<br />
/usr/local/bin/advmame victory<br />
fi</code></p>
<p>Congratulations you now have a self contained Raspberry Pi arcade emulator, reboot your Pi and test the auto-login and auto-launch.</p>
<p><code>reboot</code></p>
<p>While booting if you ever need to abort the auto-launch of AdvanceMAME you can tap <code>[Ctrl] C</code> at the <em>Welcome in your Moebius</em>. <em>Starting AdvMAME</em> notification.</p>
<h2>Install a Menu to List Games (optional)</h2>
<p><a href="http://ipggi.files.wordpress.com/2012/11/menu-snap-list.png"><img src="http://ipggi.files.wordpress.com/2012/11/menu-snap-list.png?w=300&#038;h=225" alt="advancedmenu example" width="300" height="225" class="alignnone size-medium wp-image-1123" /></a></p>
<p><a href="http://advancemame.sourceforge.net/menu-readme.html">AdvanceMenu</a> is complementary program to AdvMAME that displays a complete list of all the MAME games stored on your Pi. You can additionally select and start any game from this list. To enable this menu feature first download and install AdvanceMenu for the Pi.</p>
<p><code>cd ~<br />
wget <a href="http://sheasilverman.com/rpi/raspbian/debs/advancemenu_2.6-1_armhf.deb" rel="nofollow">http://sheasilverman.com/rpi/raspbian/debs/advancemenu_2.6-1_armhf.deb</a><br />
dpkg -i advancemenu_2.6-1_armhf.deb</code></p>
<p>Then run the program.</p>
<p><code>advmenu</code></p>
<p>You should see a white menu with a list of all your MAME ROMs. The big grey box is where any preview images get displayed.</p>
<p>If you ever receive an XML syntax error at launch, delete the advmame.xml file and try again.</p>
<p><code>rm ~/.advance/advmenu.xml<br />
advmenu</code></p>
<p>Use the keyboard arrow keys to navigate between games and press <code>[Enter]</code> to launch the selected title. <code>[F1]</code> displays the AdvanceMenu options while <code>[ESC]</code> exits you to the Linux shell.</p>
<p>Preview images (snapshots) are in <code>~/.advance/snap</code>. You can either download a collection online <a href="http://www.progettosnaps.net/snaps_en.html">http://www.progettosnaps.net/snaps_en.html</a> and place them in there or create your own by pressing the <code>[F12]</code> key when in-game.</p>
<p>If you want to launch <code>advmenu</code> at boot first make sure you follow the previous <em>Start MAME At Boot</em> instructions. But instead of launching <em>advmame [game]</em> edit the root <code>.bashrc</code> file to launch <code>advmenu</code>.</p>
<p><code>nano +6 ~/.bashrc</code></p>
<p>Replace<br />
<code>/usr/local/bin/advmame [game]</code></p>
<p>with<br />
<code>#/usr/local/bin/advmame [game]<br />
/usr/local/bin/advmenu</code></p>
<p>Save the changes and reboot.</p>
<p>&nbsp;</p>
<h2>Troubleshooting MAME</h2>
<h3>Slow or bugged hardware</h3>
<p>If you are suffering from slower than expected hardware performance issues you may wish to update the Raspberry Pi&#8217;s fireware. Follow the <em>README.md</em> instructions for <code>rpi-update</code> at <a href="https://github.com/Hexxeh/rpi-update">https://github.com/Hexxeh/rpi-update</a> so your Pi is refreshed to utilise the latest drivers for its hardware. This could improve performance and solve possible hardware bugs.</p>
<p>Another option to improve performance would be to run <code>moebius.config</code> and select <em>Overclock</em> to change the Pi&#8217;s clock preset to something greater than <em>Warp1</em>.</p>
<h3>Audio problems</h3>
<p>The older ALSA drivers on the Pi are known to have quality issues when software is not running at full speed. I originally had big problems using the 3.5mm headphone jack combined with a HDMI display output, yet audio via HDMI worked perfectly. I would recommend an update to your Pi&#8217;s firmware, follow the README.md instructions for the use of rpi-update at <a href="https://github.com/Hexxeh/rpi-update">https://github.com/Hexxeh/rpi-update</a>.</p>
<p>If you have no audio output run <code>alsamixer</code> (alias <code>raspi-audio</code>). Use the arrow-keys to adjust the <em>PCM volume</em> to make sure it is at least a value of <code>41</code>.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/alsamixer.png"><img class="alignnone size-medium wp-image-861" title="alsamixer" alt="" src="http://ipggi.files.wordpress.com/2012/11/alsamixer.png?w=300&#038;h=170" width="300" height="170" /></a></p>
<h3>Controllers</h3>
<p>Potentially due to the power requirements you may find that your USB joypad or joystick will not work with your Pi. My Xbox 360 USB controller failed to work even when attached to the Pi via a powered USB hub. Using a 10 volt over-charge USB source to power my Pi didn&#8217;t help either. My imported Elecom joystick mentioned at the start of this article worked fine.</p>
<h3>Using a non-root account</h3>
<p>Though it is against best practice to use <code>root</code> for a general Linux activity I could not get AdvanceMAME with the USB drivers to correctly work without it. If you have better luck please let me know. Strangely one edit you need to make to launch AdvanceMAME as a non-root user is to as root give the floppy disk driver <code>other</code> group read write access.</p>
<p><code>chmod o+rw /dev/fd0</code></p>
<h2>ERROR: required files are missing</h2>
<p>There are several reasons why you may receive this error, see the MAME development FAQ.<br />
<a class="vt-p" href="http://mamedev.org/devwiki/index.php/FAQ:ROMs#Why_does_MAME_report_.22missing_files.22_even_if_I_have_the_ROMs.3F">http://mamedev.org/devwiki/index.php/FAQ:ROMs#Why_does_MAME_report_.22missing_files.22_even_if_I_have_the_ROMs.3F</a></p>
<br />Filed under: <a href='http://ipggi.wordpress.com/category/mame/'>MAME</a>, <a href='http://ipggi.wordpress.com/category/raspberry-pi/'>Raspberry Pi</a> Tagged: <a href='http://ipggi.wordpress.com/tag/advancemame/'>AdvanceMAME</a>, <a href='http://ipggi.wordpress.com/tag/advancemenu/'>AdvanceMenu</a>, <a href='http://ipggi.wordpress.com/tag/arm/'>ARM</a>, <a href='http://ipggi.wordpress.com/tag/auto-launch/'>auto-launch</a>, <a href='http://ipggi.wordpress.com/tag/auto-login/'>auto-login</a>, <a href='http://ipggi.wordpress.com/tag/auto-start/'>auto-start</a>, <a href='http://ipggi.wordpress.com/tag/imame/'>iMAME</a>, <a href='http://ipggi.wordpress.com/tag/moebius/'>Moebius</a>, <a href='http://ipggi.wordpress.com/tag/rom/'>ROM</a>, <a href='http://ipggi.wordpress.com/tag/sftp/'>sftp</a>, <a href='http://ipggi.wordpress.com/tag/ssh/'>ssh</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ipggi.wordpress.com/805/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ipggi.wordpress.com/805/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=805&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ipggi.wordpress.com/2012/11/26/mame-arcade-game-fun-with-a-raspberry-pi/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01aa96818e11d6d361d9832c957f8a0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ipggi</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/moebius-1-1-0-main-configuration.png?w=150" medium="image">
			<media:title type="html">moebius 1.1.0 main configuration</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/hostname-i.png" medium="image">
			<media:title type="html">hostname i</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/setting-up-putty-for-a-connection1.png?w=300" medium="image">
			<media:title type="html">setting up putty for a connection</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/putty-copying-text-to-the-clipboard.png?w=300" medium="image">
			<media:title type="html">putty copying text to the clipboard</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/nano-profile-edit1.png?w=300" medium="image">
			<media:title type="html">nano profile edit</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/installing-advancemame1.png?w=300" medium="image">
			<media:title type="html">installing advancemame</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/advmame-first-time.png?w=300" medium="image">
			<media:title type="html">advmame first time</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/added-device_video_clock1.png?w=300" medium="image">
			<media:title type="html">added device_video_clock</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/sound_samplerate.png" medium="image">
			<media:title type="html">sound_samplerate</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/advmame-victory.png?w=300" medium="image">
			<media:title type="html">advmame victory</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/diagnostic-testing-failure.jpg?w=300" medium="image">
			<media:title type="html">diagnostic testing failure</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/victory-title-screen.jpg?w=300" medium="image">
			<media:title type="html">victory title screen</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/filezilla-quickconnect.png?w=300" medium="image">
			<media:title type="html">filezilla quickconnect</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/filezilla-quickhelp.png?w=300" medium="image">
			<media:title type="html">filezilla quickhelp</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/menu-snap-list.png?w=300" medium="image">
			<media:title type="html">advancedmenu example</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/alsamixer.png?w=300" medium="image">
			<media:title type="html">alsamixer</media:title>
		</media:content>
	</item>
		<item>
		<title>MAME Arcade Game Fun With A Raspberry Pi Beginner Supplimental</title>
		<link>http://ipggi.wordpress.com/2012/11/24/mame-arcade-game-fun-with-a-raspberry-pi-beginner-supplimental/</link>
		<comments>http://ipggi.wordpress.com/2012/11/24/mame-arcade-game-fun-with-a-raspberry-pi-beginner-supplimental/#comments</comments>
		<pubDate>Sat, 24 Nov 2012 04:08:52 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://ipggi.wordpress.com/?p=815</guid>
		<description><![CDATA[To avoid confusion please note that this entry has been updated in May of 2013. Some of the screen captures show older versions of Moebius in use. This mini-entry is a supplemental article for first time Raspberry Pi owners using Windows PCs who are reading my MAME Arcade Game Fun With A Raspberry Pi article. [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=815&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><ins datetime="2013-05-06T00:55:14+00:00">To avoid confusion please note that this entry has been updated in May of 2013. Some of the screen captures show older versions of Moebius in use.</ins></p>
<p>This mini-entry is a supplemental article for first time Raspberry Pi owners using Windows PCs who are reading my <a class="vt-p" href="http://ipggi.wordpress.com/2012/11/26/mame-arcade-game-fun-with-a-raspberry-pi/">MAME Arcade Game Fun With A Raspberry Pi article</a>. This article not intended to be read stand-alone.</p>
<h2>Tools for Windows</h2>
<p>On the PC software side of things I use a couple of programs.</p>
<p><em>7-Zip</em> A free and open-source file archiver. <a class="vt-p" href="http://www.7-zip.org/download.html">http://www.7-zip.org/download.html</a><br />
<em>Image Writer for Windows</em> A free and open-source USB stick and SD card image tool. <a class="vt-p" href="https://launchpad.net/win32-image-writer/+download">https://launchpad.net/win32-image-writer/+download</a> (only get the binaries download, not the source)</p>
<p>If installing 7-Zip for the first time you probably will want to change some of the options. For 64-bit Window users to successfully save setting changes they will need to execute <em>Run as administrator</em>, do this with a right-mouse click on the <em>7-Zip File Manager </em>program.</p>
<div id="attachment_821" class="wp-caption alignnone" style="width: 240px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/7-zip-run-as-administrator.png"><img class=" wp-image-821 " title="7-Zip run as administrator" alt="" src="http://ipggi.files.wordpress.com/2012/11/7-zip-run-as-administrator.png?w=230&#038;h=228" width="230" height="228" /></a><p class="wp-caption-text">7-Zip run as administrator</p></div>
<p>Launch 7-Zip and select <em>Tools</em>, <em>Options</em>. In the <em>System</em> dialogue make sure <em>tar</em>, <em>gz</em> and <em>gzip</em> are <em>Associate 7-Zip with:</em>. Unless you have a reason not to I&#8217;d recommend pressing <em>Select All</em> and using 7-Zip as your default file archiver.</p>
<div id="attachment_822" class="wp-caption alignnone" style="width: 244px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/7-zip-system-options.png"><img class="size-medium wp-image-822" title="7-zip system options" alt="" src="http://ipggi.files.wordpress.com/2012/11/7-zip-system-options.png?w=234&#038;h=300" width="234" height="300" /></a><p class="wp-caption-text">7-zip system options</p></div>
<p>You may want to integrate 7-Zip into file explorer, that will allow you to use a right-click to interact with archives using a 7-Zip context menu. Select the <em>7-Zip</em> tab and select both <em>Integrate 7-Zip to shell context menu</em> and <em>Cascaded context menu</em>, Press <em>OK</em> and close 7-Zip.</p>
<h2>Setting Up Your PC</h2>
<p>I keep a directory named <em>Raspberry Pi</em> that houses all my SD card images. This is so I can have any image readily available, to keep backups in-case I break something and need do a Raspberry Pi equivalent of a Windows System Restore. To speed things up I do not use a file archiver to compress the SD card images, rather I leave them in their raw <code>.img</code> state. Instead I use a little known feature and allow Windows to compress the directory.</p>
<p>To do this right-click the directory in question, select <em>Properties</em>, <em>General</em> tab, press <em>Advanced</em> and then check the <em>Compress contents to save disk space</em> under the <em>Compress or Encrypt</em> attributes. This shrank the 900 MB Moebius image to use just 322 MB on disk.</p>
<div id="attachment_823" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/folder-properties-advanced-attributes.png"><img class="size-medium wp-image-823" title="folder properties advanced attributes" alt="" src="http://ipggi.files.wordpress.com/2012/11/folder-properties-advanced-attributes.png?w=300&#038;h=180" width="300" height="180" /></a><p class="wp-caption-text">Windows folder properties advanced attributes</p></div>
<p><a href="http://sourceforge.net/projects/moebiuslinux/files/raspberry.stable/">Download the Moebius minimal image</a> which was at the time of writing is <del datetime="2013-05-06T00:55:14+00:00"><code>moebius.minimal.image.1.0.1.tar.gz</code></del> <ins datetime="2013-05-06T00:55:14+00:00"><code>moebius-1.1.0.tar.gz</code></ins>. Move it do your Raspberry Pi image directory and right-click on the file to use the 7-Zip context menu to <em>Extract here</em>. Once extracted you will have a larger <del datetime="2013-05-06T00:55:14+00:00"><code>moebius.minimal.image.1.0.1.tar</code></del> <ins datetime="2013-05-06T00:55:14+00:00"><code>moebius-1.1.0.tar</code></ins> archive. Right-click the file to again apply the 7-Zip <em>Extract here</em> context menu.</p>
<div id="attachment_824" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/mobeus-extracted.png"><img class="size-medium wp-image-824" title="mobeus extracted" alt="" src="http://ipggi.files.wordpress.com/2012/11/mobeus-extracted.png?w=300&#038;h=49" width="300" height="49" /></a><p class="wp-caption-text">Mobeus extracted</p></div>
<p>The extracted image is missing a <code>.img</code> file extension and Windows does not recognise it. Right-click the file and <em>Rename</em>. Add <code>.img</code> to the end of the file name, press <code>[Enter]</code>. Press <em>Yes</em> at any Windows prompt.</p>
<div id="attachment_825" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/added-img-extension-to-moebius.png"><img class="size-medium wp-image-825" title="add .img extension to moebius" alt="" src="http://ipggi.files.wordpress.com/2012/11/added-img-extension-to-moebius.png?w=300&#038;h=48" width="300" height="48" /></a><p class="wp-caption-text">Add .img extension to moebius</p></div>
<p>Delete the <del datetime="2013-05-06T00:55:14+00:00"><code>moebius.minimal.image.1.0.1.tar.gz</code></del> <ins datetime="2013-05-06T00:55:14+00:00"><code>moebius-1.1.0.tar.gz</code></ins> and <del datetime="2013-05-06T00:55:14+00:00"><code>moebius.minimal.image.1.0.1.tar</code></del> <ins datetime="2013-05-06T00:55:14+00:00"><code>moebius-1.1.0.tar</code></ins> archives if you wish.</p>
<h2>Image Transfers</h2>
<p>Copy the <em>Image Writer for Windows</em> file <code>win32diskimager-binary.zip</code> to your Raspberry Pi image directory and use the 7-Zip context menu <em>Extract to win32diskimager-binary</em>. Plug the SD card reader into your PC and run <code>Win32DiskImager.exe</code> which is in the <code>win32diskimager-binary</code> directory.</p>
<div id="attachment_826" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/win32diskimager-application.png"><img class="size-medium wp-image-826" title="win32diskimager application" alt="" src="http://ipggi.files.wordpress.com/2012/11/win32diskimager-application.png?w=300&#038;h=110" width="300" height="110" /></a><p class="wp-caption-text">win32diskimager application</p></div>
<p>The SD card is given a drive letter by Windows and is under <em>Devices</em>. If you have more than 1 device listed, use <em>My Computer</em> in the <em>Windows Start</em> to find which letter to use.</p>
<div id="attachment_827" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/discover-sd-card-letter.png"><img class="size-medium wp-image-827" title="discover sd card letter" alt="" src="http://ipggi.files.wordpress.com/2012/11/discover-sd-card-letter.png?w=300&#038;h=254" width="300" height="254" /></a><p class="wp-caption-text">Discover SD card</p></div>
<p>To backup the existing data on the SD card, use the <em>Image File</em> selector to create a new image name and then press <em>Read</em>. Otherwise to transfer Moebius to the SD card use the <em>Image File</em> selector to choose the <del datetime="2013-05-06T00:55:14+00:00"><code>mobieus.minimal.image.1.0.1.img</code></del> <ins datetime="2013-05-06T00:55:14+00:00"><code>moebius-1.1.0.img</code></ins> and press <em>Write</em>. This will overwrite the entire content of your SD card.</p>
<div id="attachment_828" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/write-moebius-to-device.png"><img class="size-medium wp-image-828" title="write moebius to device" alt="" src="http://ipggi.files.wordpress.com/2012/11/write-moebius-to-device.png?w=300&#038;h=153" width="300" height="153" /></a><p class="wp-caption-text">Write Moebius to SD card</p></div>
<p>Once the writing is complete, bring up <em>My Computer</em> from the <em>Windows Start</em>, right-click your SD card drive and <em>Eject</em> it. It is safe to remove the SD card from your PC and insert it into your Raspberry Pi.</p>
<div id="attachment_829" class="wp-caption alignnone" style="width: 236px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/11/eject-sd-card.png"><img class="size-medium wp-image-829" title="eject sd card" alt="" src="http://ipggi.files.wordpress.com/2012/11/eject-sd-card.png?w=226&#038;h=300" width="226" height="300" /></a><p class="wp-caption-text">Eject SD card</p></div>
<p>Continue to First Boot in <a class="vt-p" href="http://ipggi.wordpress.com/2012/11/26/mame-arcade-game-fun-with-a-raspberry-pi/#firstboot">MAME Arcade Game Fun With A Raspberry Pi</a>.</p>
<br />Filed under: <a href='http://ipggi.wordpress.com/category/raspberry-pi/'>Raspberry Pi</a>, <a href='http://ipggi.wordpress.com/category/windows/'>Windows</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ipggi.wordpress.com/815/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ipggi.wordpress.com/815/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=815&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ipggi.wordpress.com/2012/11/24/mame-arcade-game-fun-with-a-raspberry-pi-beginner-supplimental/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01aa96818e11d6d361d9832c957f8a0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ipggi</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/7-zip-run-as-administrator.png" medium="image">
			<media:title type="html">7-Zip run as administrator</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/7-zip-system-options.png?w=234" medium="image">
			<media:title type="html">7-zip system options</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/folder-properties-advanced-attributes.png?w=300" medium="image">
			<media:title type="html">folder properties advanced attributes</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/mobeus-extracted.png?w=300" medium="image">
			<media:title type="html">mobeus extracted</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/added-img-extension-to-moebius.png?w=300" medium="image">
			<media:title type="html">add .img extension to moebius</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/win32diskimager-application.png?w=300" medium="image">
			<media:title type="html">win32diskimager application</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/discover-sd-card-letter.png?w=300" medium="image">
			<media:title type="html">discover sd card letter</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/write-moebius-to-device.png?w=300" medium="image">
			<media:title type="html">write moebius to device</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/11/eject-sd-card.png?w=226" medium="image">
			<media:title type="html">eject sd card</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux, Mac OS, Unix: File Permissions and User Classes</title>
		<link>http://ipggi.wordpress.com/2012/07/01/linux-file-permissions-and-user-classes/</link>
		<comments>http://ipggi.wordpress.com/2012/07/01/linux-file-permissions-and-user-classes/#comments</comments>
		<pubDate>Sun, 01 Jul 2012 02:11:06 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[block special files]]></category>
		<category><![CDATA[character special files]]></category>
		<category><![CDATA[chmod]]></category>
		<category><![CDATA[chown]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[fifo]]></category>
		<category><![CDATA[groups]]></category>
		<category><![CDATA[ll]]></category>
		<category><![CDATA[ln]]></category>
		<category><![CDATA[ls]]></category>
		<category><![CDATA[Mac OS]]></category>
		<category><![CDATA[named pipes]]></category>
		<category><![CDATA[octal notion]]></category>
		<category><![CDATA[owner]]></category>
		<category><![CDATA[permission bits]]></category>
		<category><![CDATA[permissions]]></category>
		<category><![CDATA[symbolic link]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://ipggi.wordpress.com/?p=639</guid>
		<description><![CDATA[Using the Linux terminal (command line) I am going to explain in thorough detail the mysteries that are the Linux system file permissions for the uninitiated. I will be using Ubuntu Linux 12.04 LTS but most of what is covered should be applicable for any POSIX compatible Linux, Mac OS or Unix environment. If this [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=639&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Using the Linux terminal (command line) I am going to explain in thorough detail the mysteries that are the Linux system file permissions for the uninitiated. I will be using Ubuntu Linux 12.04 LTS but most of what is covered should be applicable for any POSIX compatible Linux, Mac OS or Unix environment.</p>
<p>If this walkthrough tutorial does not meet your needs I have provided some links to other articles on this subject at the end of the piece.</p>
<p>For this article I will interchange the term ‘file or directory’ for the word ‘item’.</p>
<h1>List -long</h1>
<p>If you have ready access to a Linux terminal enter the following commands.</p>
<p><code> cd /boot<br />
ls<br />
</code></p>
<div id="attachment_751" class="wp-caption alignnone" style="width: 730px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/06/8-06-2012-11-12-49-am.png"><img class=" wp-image-751 " title="cd /boot | ls" src="http://ipggi.files.wordpress.com/2012/06/8-06-2012-11-12-49-am.png?w=720&#038;h=98" alt="" width="720" height="98" /></a><p class="wp-caption-text">Output of the <em>ls</em> command performed on the directory /boot</p></div>
<p>A list similar to the image above should be outputted. The <em>ls </em>command lists the content of the current directory. You can discover the list command’s many options and parameters in the Ubuntu manual pages. <a class="vt-p" href="http://manpages.ubuntu.com/manpages/precise/man1/ls.1.html">http://manpages.ubuntu.com/manpages/precise/man1/ls.1.html</a>.</p>
<p><code>ls -l</code></p>
<div id="attachment_750" class="wp-caption alignnone" style="width: 730px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/06/8-06-2012-11-14-21-am.png"><img class=" wp-image-750 " title="cd /boot | ls -l original" src="http://ipggi.files.wordpress.com/2012/06/8-06-2012-11-14-21-am.png?w=720&#038;h=178" alt="" width="720" height="178" /></a><p class="wp-caption-text">Output of the ls -l command performed on the directory /boot</p></div>
<p>By using the <em>-l</em> (lowercase L) option with the list command we display the content in a long and more detail format.</p>
<p><code>ll</code></p>
<div id="attachment_749" class="wp-caption alignnone" style="width: 730px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/06/8-06-2012-11-21-13-am2.png"><img class=" wp-image-749  " title="cd /boot | ll coloured" src="http://ipggi.files.wordpress.com/2012/06/8-06-2012-11-21-13-am2.png?w=720&#038;h=210" alt="" width="720" height="210" /></a><p class="wp-caption-text">Hand coloured output of the ll command performed on the directory /boot</p></div>
<p>The <em>ll</em> (lowercase LL) command is available on many Linux distributions and is a shortcut that displays identical results to<em> ls -l</em>. For the output above I have colour coded the different columns of item information so I can describe their purpose.</p>
<ul>
<li><span style="color:#339966;"><span style="color:#800000;">Red</span><span style="color:#000000;">:</span> <span style="color:#000000;">lists the item type</span></span></li>
<li><span style="color:#339966;">Green</span>: lists the item&#8217;s permissions.</li>
<li><span style="color:#cc99ff;">Purple</span>: lists the total number of hard links pointing to the item.</li>
<li><span style="color:#ff99cc;">Pink</span>: lists the item&#8217;s user (which is the owner) and its applied group.</li>
<li><span style="color:#0000ff;">Blue</span>: lists the size of the item in bytes.</li>
<li><span style="color:#993300;">Orange/Brown</span>: lists the date and time the item was last modified.</li>
<li>White: list the item name though some items in this column may have alternative colourings.</li>
</ul>
<h1>Item Type</h1>
<p>The item type can be broken down into 6 values.</p>
<ul>
<li><strong>-</strong> (dash) is a standard file.</li>
<li><strong>d</strong> is a standard directory.</li>
<li><strong>l</strong> (lowercase L) is a symbolic link otherwise known as a symlink.</li>
<li><strong>p</strong> is a named pipe otherwise known as a FIFO (file-in, file-out).</li>
<li><strong>b</strong> is a block special file.</li>
<li><strong>c</strong> is a character special file.</li>
</ul>
<h2>Standard Files and Standard Directories</h2>
<p>Standard files and standard directories are the bread and butter of your Linux system. Files are documents of data. While a directory is a container which can hold multiple files as well as additional directories which are called subdirectories.</p>
<h2>Symbolic Link</h2>
<p>A symbolic or a soft link is a pointer to another file or directory. This enables you to have an item (called a target) in one location and one or more links pointing to to the target located elsewhere on the file system. These pointers can open, read and write to the target. Here is a little demo.</p>
<p><code>mkdir ~/blogdemo<br />
cd ~/blogdemo/<br />
echo "Hello world" &gt;&gt; hi<br />
cat hi<br />
ln -s hi readme<br />
cat readme</code></p>
<div id="attachment_753" class="wp-caption alignnone" style="width: 730px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/06/8-06-2012-4-39-37-pm.png"><img class=" wp-image-753 " title="echo &quot;hello world&quot; &gt;&gt; hi" src="http://ipggi.files.wordpress.com/2012/06/8-06-2012-4-39-37-pm.png?w=720&#038;h=257" alt="" width="720" height="257" /></a><p class="wp-caption-text">Create a text file and then a symlink to it</p></div>
<p>Okay so what I just did was to create a new text file called ‘hi’ and then display it. I then created a symbolic link named ‘readme’ that pointed to the new text file. And finally I displayed onscreen the content of the ‘readme’ link.</p>
<p>The <em>mkdir</em> command creates a new directory.<br />
<em>echo &#8220;text&#8221;</em> prints the text contained within the quotes.<br />
<em>&gt;&gt;</em> pipes (moves) the printed text into the file named ‘hi’.<br />
<em>cat</em> displays the content of the the file ‘hi’ onscreen.<br />
<em>ln -s &lt;target&gt; &lt;link name&gt;</em> creates a symbolic link to the target.</p>
<p>You can see with the output of the <em>ll</em> (lowercase LL) command the yellow highlighted line is a symbolic link. The item type is listed with a ‘l’ (lowercase L) while the item name ‘readme’ has an arrow ‘-&gt;’ pointing to its target, which is the text file named ‘hi’.</p>
<h2>Named Pipes</h2>
<p>While rare in usage, named pipes or FIFO are objects that allow you to feed the data output of a source program to the data input of destination program. Below will create, list and delete a pipe but its proper use is beyond this article.</p>
<p>The IBM developerWorks Learn Linux, 101: Steams, Pipes, and Redirects article covers pipes in proper detail. <a class="vt-p" href="//www.ibm.com/developerworks/linux/library/l-lpic1-v3-103-4/">http://www.ibm.com/developerworks/linux/library/l-lpic1-v3-103-4/</a></p>
<p><code>mkdir ~/blogdemo<br />
cd ~/blogdemo/<br />
mkfifo my-pipe<br />
ll<br />
rm my-pipe</code></p>
<div id="attachment_755" class="wp-caption alignnone" style="width: 730px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/06/8-06-2012-5-30-09-pm.png"><img class=" wp-image-755 " title="mkinfo my-pipe" src="http://ipggi.files.wordpress.com/2012/06/8-06-2012-5-30-09-pm.png?w=720&#038;h=179" alt="" width="720" height="179" /></a><p class="wp-caption-text">Creating a named pipe</p></div>
<h2>Block and Character Special Files</h2>
<p>In most situations you will not need to worry about either one of these file types. Block special files and character special files are unique in that they can receive and generate data. They are most commonly used by files that permit terminal and file system interactions with a piece of physical hardware attached to the computer. Block special files can handle multiple characters at once while character special files only handle single characters. Below is an example of some block special files that can be used to interact with the computer’s SATA hard disks.</p>
<p><code>ll /dev/sda*</code></p>
<div id="attachment_758" class="wp-caption alignnone" style="width: 730px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/06/8-06-2012-5-36-47-pm.png"><img class=" wp-image-758  " title="ll /dev/sda*" src="http://ipggi.files.wordpress.com/2012/06/8-06-2012-5-36-47-pm.png?w=720&#038;h=97" alt="" width="720" height="97" /></a><p class="wp-caption-text">List of SATA hard disks</p></div>
<h1>Permissions</h1>
<p>From here I will cover file-directory permissions and classes. The commands below will setup a couple of demonstration files in your home (<em>~</em>) directory.</p>
<p><code>cd ~/blogdemo/<br />
echo "I am a filler file" &gt; file1<br />
echo "I am another filler file" &gt; file2<br />
chown ben file1<br />
sudo chown :root file2<br />
ll</code></p>
<div id="attachment_781" class="wp-caption alignnone" style="width: 730px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/07/30-06-2012-10-09-52-am-coloured.png"><img class=" wp-image-781" title="echo &quot;&quot; &gt; file1 file2 - coloured" src="http://ipggi.files.wordpress.com/2012/07/30-06-2012-10-09-52-am-coloured.png?w=720&#038;h=211" alt="" width="720" height="211" /></a><p class="wp-caption-text">Creating 2 text files for testing</p></div>
<h2>Owner and Groups</h2>
<p>The first thing you should look at in the previous screenshot is the <span style="color:#993300;">orange/brown</span> column which contains the owners of the items. The <span style="color:#99ccff;">purple</span> column that sits next to it lists the groups assigned to the items.</p>
<p>A group is a collection of different user accounts associated together under a common name. A user account can either have no group assigned, a single primary group assigned or a primary group with multiple secondary groups assigned.</p>
<p>A list of your Linux users are stored in the <em>/etc/passwd</em> file.<br />
<code>nano /etc/passwd</code></p>
<p>The groups are stored in the <em>/etc/group</em> file.<br />
<code>nano /etc/group</code></p>
<div id="attachment_762" class="wp-caption alignnone" style="width: 730px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/06/8-06-2012-5-54-37-pm.png"><img class=" wp-image-762 " title="cat /etc/passwd" src="http://ipggi.files.wordpress.com/2012/06/8-06-2012-5-54-37-pm.png?w=720&#038;h=65" alt="" width="720" height="65" /></a><p class="wp-caption-text">An extraction of the /etc/passwd file</p></div>
<div id="attachment_763" class="wp-caption alignnone" style="width: 730px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/06/8-06-2012-5-55-18-pm.png"><img class=" wp-image-763 " title="cat /etc/group" src="http://ipggi.files.wordpress.com/2012/06/8-06-2012-5-55-18-pm.png?w=720&#038;h=95" alt="" width="720" height="95" /></a><p class="wp-caption-text">An extraction of the /etc/group file</p></div>
<p>The Ubuntu manual pages has more on the content and format of these passwd and group files.<br />
<a class="vt-p" href="//manpages.ubuntu.com/manpages/precise/man5/group.5.html">http://manpages.ubuntu.com/manpages/precise/man5/passwd.5.html</a><br />
<a class="vt-p" href="//manpages.ubuntu.com/manpages/precise/man5/group.5.html">http://manpages.ubuntu.com/manpages/precise/man5/group.5.html</a></p>
<h2>Classes and Permissions</h2>
<div id="attachment_764" class="wp-caption alignnone" style="width: 730px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/06/8-06-2012-5-53-49-pm.png"><img class=" wp-image-764 " title="coloured ll of ~" src="http://ipggi.files.wordpress.com/2012/06/8-06-2012-5-53-49-pm.png?w=720&#038;h=211" alt="" width="720" height="211" /></a><p class="wp-caption-text">Classes and permissions colour coded</p></div>
<p>The permissions comprise of 9 cryptic columns of data which are individually called bits and they can be separated into 3 classes.</p>
<p>The first set of 3 columns (<span style="color:#800000;">coloured in red</span>) belong to the ‘user’ class which is the owner of the item. Remember the owner is listed in the <span style="color:#993300;">orange/brown</span> coloured column.</p>
<p>The second set of 3 columns (<span style="color:#0000ff;">coloured in blue</span>) belong to the ‘group’ assigned class, that group is listed in the <span style="color:#cc99ff;">purple</span> coloured column.</p>
<p>While the third set of 3 columns (<span style="color:#008000;">coloured in green</span>) belong to the ‘other’ class. These are users who do not fall into the previous two classes.</p>
<p>Each of these classes with their 3 individual columns of bits adhere to an identical format that is set to one of these six combinations.</p>
<p><strong>wrx, wr-, w&#8211;, -rx,-r-,&#8211;x</strong></p>
<ul>
<li><strong>w</strong> states the write permission is granted</li>
<li><strong>r</strong> states the read permission is granted</li>
<li><strong>x</strong> states the execute permission is granted</li>
<li><strong>-</strong> states the permission is denied and acts as the negative bit character for <strong>w</strong>, <strong>r</strong> and <strong>x</strong>.</li>
</ul>
<p>So for example <strong>wrx</strong> means write, read and execute has been granted. While <strong>-r-</strong> means only read has been granted and write and execute have been denied.</p>
<p>The function of these permission bits is different depending on whether the item is a directory or a file.</p>
<h3>File Permission Bits.</h3>
<p><strong>w</strong> is the write bit, it allows the file to be modified, renamed and deleted.<br />
<strong>r</strong> is the read bit, it allows the content of a file to be viewed.<br />
<strong>x</strong> is the execute bit, it registers the file as a program and allows it to be run.</p>
<h3>Directory Permission Bits.</h3>
<p><strong>w</strong> is the write bit, it allows the directory to be renamed or deleted plus it allows new files and subdirectories to be created within.<br />
<strong>r</strong> is the read bit, it allows the content of the directory to be listed using commands such as <em>ls</em> or <em>ll</em>.<br />
<strong>x</strong> is the execute bit, it allows access into the directory using commands such as <em>cd</em>. If the execute bit has been denied (<em>-</em>) access to all subdirectories and files within this directory will be barred. This denied bit overrides both the directory’s write bit and read bit permissions.</p>
<h3>Let’s take a closer look at the file ‘file1’.</h3>
<div id="attachment_765" class="wp-caption alignnone" style="width: 730px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/06/8-06-2012-7-00-55-pm.png"><img class=" wp-image-765 " title="file1 in detail" src="http://ipggi.files.wordpress.com/2012/06/8-06-2012-7-00-55-pm.png?w=720&#038;h=16" alt="" width="720" height="16" /></a><p class="wp-caption-text">file1 in detail</p></div>
<p>The <span style="color:#993300;">orange/brown</span> text tells us that this file is owned by the user ‘root’.<br />
The <span style="color:#800080;">purple </span>text shows that the file is assigned to the group named ‘ben’.</p>
<p>Now looking at the permissions.</p>
<p>The <span style="color:#ff0000;">red </span>set of bits are the permissions for the user which is another name for the owner. This owner ‘root’ can read and write to (rename, delete or modify) this file. These permissions nullify any of the lesser class permissions that might also match the owner.</p>
<p>The <span style="color:#00ccff;">blue </span>set of bits are for the group ‘ben’ which is assigned to this file. Users assigned to ‘ben’ can read and write to (rename, delete or modify) this file.</p>
<p>The <span style="color:#339966;">green</span> set of bits are for others who are users that do not fit the previous two classes. They can only read this file.</p>
<h3>Let&#8217;s take a closer look at the directory blogdemo/.</h3>
<div id="attachment_766" class="wp-caption alignnone" style="width: 730px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/06/8-06-2012-6-50-54-pm.png"><img class=" wp-image-766 " title="blogdemo inb detail" src="http://ipggi.files.wordpress.com/2012/06/8-06-2012-6-50-54-pm.png?w=720&#038;h=17" alt="" width="720" height="17" /></a><p class="wp-caption-text">blogdemo/ in detail</p></div>
<p>Firstly the<span style="color:#993300;"> orange/brown</span> text tells us this directory is owned by the user ‘ben’.</p>
<p>The <span style="color:#800080;">purple</span> text states that the directory has been assigned to the group ‘ben’. When a new user account is created a default group under the same name is also generated. This group is then assigned to the user and is used as their primary group.</p>
<p>The <span style="color:#ff0000;">red</span> set of bits is for the user which is another name for the owner. The owner ‘ben’ has write (rename, delete, add new files or subdirectories with), read (list content) and execute (access into the directory) permissions.</p>
<p>The <span style="color:#00ccff;">blue</span> set of bits is for the group assigned to this directory which is named ‘ben’. Users who are assigned to the group ‘ben’ have write (rename, delete, add new files or subdirectories with), read (list content) and execute (access into the directory) permissions.</p>
<p>Please note that ‘ben’ is the owner of this directory, he is also assigned to the group ‘ben’. As there is a conflict the (lesser) group permissions are nullified for him as the user (owner) permission bits take precedence.</p>
<p>The <span style="color:#339966;">green </span>set of bits are for other and they are the users that do not fit in the previous two classes. They have permission to read (list content) and execute (access into the directory).</p>
<h2>Change owner (chown) or change modification (chmod)</h2>
<p>When you create a new directory or a new file that item’s ownership is automatically set to you. Your primary group is also assigned to the item. When you create an item while using the <em>sudo</em> (superuser do) command ownership is given to ‘root’ and the group is assigned to ‘root’.</p>
<p><code>cd ~/blogdemo<br />
mkdir bens_stuff<br />
sudo mkdir roots_stuff<br />
ll<br />
</code></p>
<div id="attachment_767" class="wp-caption alignnone" style="width: 730px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/06/30-06-2012-10-55-39-am.png"><img class=" wp-image-767 " title="mkdir bens_stuff and sudo mkdir roots_stuff" src="http://ipggi.files.wordpress.com/2012/06/30-06-2012-10-55-39-am.png?w=720&#038;h=191" alt="" width="720" height="191" /></a><p class="wp-caption-text">An example of the automatic ownership and group assignments to newly created directories</p></div>
<h3>To change ownership or group assignment of an item you can use the chown command.</h3>
<p>To change the owner.<br />
<code>chown &lt;user name&gt; &lt;item&gt;</code></p>
<p>To change the group assignment apply a semicolon before the group name.<br />
<code>chown :&lt;group name&gt; &lt;item&gt;</code></p>
<p>You can change both the owner and group assignment together and also apply the changes to multiple items at once.<br />
<code>chown &lt;user name&gt;:&lt;group name&gt; &lt;item1&gt; &lt;item2&gt; &lt;item3&gt;</code></p>
<p>In Ubuntu you can obtain a list of users and the list of groups by running the following.<br />
<code>nano /etc/passwd<br />
nano /etc/group</code></p>
<h3>To change the item permissions you can use the chmod command.</h3>
<p><code>chmod &lt;option&gt; &lt;mode&gt; &lt;item&gt;</code></p>
<p><em>chmod -c</em> will verbosely display all changes to each item you make which is useful in checking for mistakes.</p>
<p>The <em>&lt;mode&gt;</em> is broken down into three sets of requirements that we will isolate with squared brackets.</p>
<p><code>chmod -c [class][sign][permission] &lt;item&gt;</code></p>
<p>The <em>[class]</em> set are the user classes of the item you wish to modify and it permits the following options.<br />
<em>[ugoa]</em> <strong>u</strong> user (owner), <strong>g</strong> group, <strong>o</strong> other, <strong>a</strong> all.</p>
<p>You can apply more than one class at a time, for example the following would make changes to both the item’s user and the group classes.</p>
<p><code>chmod -c ug[sign][permission] &lt;item&gt;</code></p>
<p>While the all (<strong>a</strong>) class is a shortcut that combines the user (<strong>u</strong>), group (<strong>g</strong>) and other (<strong>o</strong>) classes. The two commands below have identical functionality.</p>
<p><code>chmod -c a[sign][permission] &lt;item&gt;<br />
chmod -c ugo[sign][permission] &lt;item&gt;</code></p>
<p>The second set of input <em>[sign]</em> involves mathematical signs which represent the method we want to apply.<br />
<em>[-+=]</em> <strong>+</strong> add, <strong>-</strong> remove, <strong>=</strong> set (replace)</p>
<p><strong>+</strong> add will insert <em>[permission]</em> to the item class.<br />
<strong>-</strong> remove will delete <em>[permission]</em> from the item class.<br />
<strong>=</strong> set will delete all existing permissions from the class and replace them with <em>[permission]</em>.</p>
<p>The following would add <em>[permission]</em> to item’s user (owner) and group classes.</p>
<p><code>chmod -c ug+[permission] &lt;item&gt;</code></p>
<p>The following would remove <em>[permission]</em> from the item’s user, group and other classes.</p>
<p><code>chmod -c ugo-[permission] &lt;item&gt;</code></p>
<p>The following would replace all permissions with <em>[permission]</em> for the item’s user, group and other classes.</p>
<p><code>chmod -c a=[permission] &lt;item&gt;</code></p>
<p>Finally the third set of input <em>[permission]</em> involves the types of access you wish to grant. These attributes are commonly referred to as bits. The word ‘bits’ is a contraction of the term ‘binary digit’ which describes a two state representation of data ie ‘enabled’ / ‘disabled’.<br />
<em>[rwxX]</em> <strong>r</strong> read, <strong>w</strong> write, <strong>x</strong> execute, <strong>X</strong> safe execute.</p>
<p>Remember I mentioned earlier in ‘File Permission Bits’ and ‘Directory Permission Bits’ that the execute bit has different functions depending on if it is applied to a directory or a file.</p>
<p>The safe execute (<strong>X</strong>) bit is recommended for use over the execute (<strong>x</strong>) bit as it does not apply the potentially dangerous execute bit to files and will only set it to directories. This is convenient when you mass-apply permissions to the content of a directory.</p>
<p>There are a couple of additional permission bits that in general can be ignored unless specifically needed.</p>
<p><em>[st]</em> <strong>s</strong> set user/group identity, <strong>t</strong> sticky</p>
<p>The set user/group identity (<strong>s</strong>) bit can only be used with the user (owner) and group classes but due to insecurities this functionality is ignored on many Linux distributions including Ubuntu.</p>
<p>When applied to a file the (<strong>s</strong>) bit grants the other class elevated execute permissions. If the (<strong>s</strong>) bit is applied to the user class, the other class will have identical execute permissions to those of the owner. The same is true when the (<strong>s</strong>) bit is applied to the group class except then the other class will temporarily be assigned to the group when executing the file.</p>
<p>When applied to a directory the (<strong>s</strong>) bit will force any newly created files or directories to inherit the group assignment of the parent directory rather than that of the user creating the item. This functionality is ignored on most Linux distributions and so the (<strong>s</strong>) bit will probably have no effect.</p>
<p>More detailed information on this bit can be read at <a class="vt-p" href="http://en.wikipedia.org/wiki/Setuid">http://en.wikipedia.org/wiki/Setuid</a></p>
<p>Finally the sticky (<strong>t</strong>) bit is an elevated setting to allow only the item’s owner or a superuser permission (such as root) to delete or rename a directory. This bit is only useful when the other or group classes have the write bit applied to the same directory. The write and sticky bit combination would then allow these classes to create new or delete existing items within the directory but it would block any changes to the directory itself.</p>
<p>So in summary you have the following classes, signs and bits that you can assign to an item.</p>
<p><code>chmod -c [ugoa][-+=][rwxXst] &lt;item&gt;</code></p>
<p>Below is a sample of chmod commands and a brief description of their function.</p>
<p><code>chmod -c go+r &lt;item&gt;<br />
</code>Adds the read permission to the group and other classes.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/07/1-07-2012-11-54-49-am.png"><img class="alignnone  wp-image-783" title="chmod -c go+r &lt;item&gt;" src="http://ipggi.files.wordpress.com/2012/07/1-07-2012-11-54-49-am.png?w=720&#038;h=34" alt="" width="720" height="34" /></a></p>
<p><code>chmod -c a-w &lt;item&gt;</code><br />
<code>chmod -c ugo-w &lt;item&gt;</code><br />
<code>chmod -c -w &lt;item&gt;</code><br />
All 3 do the same thing and remove the write permission from all classes.</p>
<p><code>chmod -c go+wt &lt;directory&gt;</code><br />
Adds the write permission to the group and other classes and assigns the sticky bit.</p>
<p><code>chmod -c a=rwX *</code><br />
Removes all previous permissions for all classes and assigns read, write and safe execute to all items in the current directory. By using the safe execute bit (<strong>X</strong>) only directories will be set with an execute bit, the execute bit for files will remain unchanged.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/07/1-07-2012-12-00-57-pm.png"><img class="alignnone  wp-image-784" title="chmod -c a=rwX *" src="http://ipggi.files.wordpress.com/2012/07/1-07-2012-12-00-57-pm.png?w=720&#038;h=83" alt="" width="720" height="83" /></a></p>
<p><code>chmod -cR a+rX *</code><br />
Adds the read and safe execute permission to all classes in the current directory. The <em>-R</em> is a recursive option to mass apply changes to all items contained within the subdirectories. This is potentially dangerous as for example if you accidently ran <em>chmod -R +x /</em> you would grant execute permission to all users for nearly every file on your Linux file system!</p>
<p><code>chmod -c o= &lt;item&gt;</code><br />
Will set the other class permission to deny.</p>
<h3>Octal Numeric Modifications</h3>
<p>While you now have all the information that you need to successfully change and modify directory-file user ownerships and permissions we are not yet finished. Often in Linux walkthroughs or instructions you will encounter a different set of numeric only permissions being used with the <em>chmod</em> command. For example..</p>
<p><code>chmod 755 &lt;directory&gt;</code></p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2012/07/1-07-2012-12-04-57-pm.png"><img class="alignnone  wp-image-785" title="chmod 755 &lt;directory&gt;" src="http://ipggi.files.wordpress.com/2012/07/1-07-2012-12-04-57-pm.png?w=720&#038;h=34" alt="" width="720" height="34" /></a></p>
<p>These numbers are known as octal notation permissions.</p>
<p>Octal numerals are a set of numbers with a base of 8 that use a numeric range of 0 &#8211; 7. This is slightly different to the more familiar decimal numerals that use a base of 10 with a numeric range of 0 &#8211; 9.</p>
<p>These octal based permissions have 4 specific digits that represent permission bits.</p>
<p><strong>0</strong> represents ‘<strong>-</strong>’ which is the denied bit.<br />
<strong>1</strong> represents ‘<strong>x</strong>’ which is the execute bit.<br />
<strong>2</strong> represents ‘<strong>w</strong>’ which is the write bit.<br />
<strong>4</strong> represents ‘<strong>r</strong>’ which is the read bit.</p>
<p>You can sum (add) different numeric values to represent combined bits.</p>
<p>1+2 = <strong>3</strong>, represents ‘<strong>w-x</strong>’ which are the write and execute bits.<br />
1+4 = <strong>5</strong>, represents ‘<strong>-rx</strong>’ which are the read and execute bits.<br />
2+4 = <strong>6</strong>, represents ‘<strong>wr-</strong>’ which are the write and read bits.<br />
1+2+4 = <strong>7</strong>, represents ‘<strong>wrx</strong>’ which are the write, read and execute bits.</p>
<p>Now <em>chmod</em> requires a 3 digit numeric value between the range of <strong>000</strong> and <strong>777</strong>. You cannot supply a single (0-7) or a double digit (00-77) value. As each digit represents a permission assignment for one of the three item classes. The first digit is for the user (owner) class, the middle digit is for the group assignment, while the final digit is for other.</p>
<p>So an octal permission value of <strong>750</strong> is..<br />
<strong>7</strong> = user (owner) class, write (<strong>2</strong>), read (<strong>4</strong>) and execute (<strong>1</strong>) bits.<br />
<strong>5</strong> = group class, read (<strong>4</strong>) and execute (<strong>1</strong>) bits.<br />
<strong>0</strong> = other class, the denied (<strong>0</strong>) bit.</p>
<p>Now hopefully these octal numbers start to make a bit more sense. But a word of warning the use of octal numbers will always overwrite any preexisting bit assignments for all classes. It is a use case shortcut and is not a replacement for adding or removing individual bits.</p>
<p><code>chmod -c 000 &lt;item&gt;</code><br />
or in text<br />
<code>chmod -c a= &lt;item&gt;</code><br />
This removes all permissions to the item.</p>
<p><code>chmod -c 755 &lt;directory&gt;</code><br />
or in text<br />
<code>chmod -c u=wrx &lt;directory&gt;</code><br />
<code>chmod -c go=rx &lt;directory&gt;</code><br />
This sets the user (owner) to have write, read and execute. While group and other classes have read and execute.</p>
<p><code>chmod -c 644 &lt;file&gt;</code><br />
or in text<br />
<code>chmod -c u=wr &lt;file&gt;</code><br />
<code>chmod -c go=r &lt;file&gt;</code><br />
This sets the user (owner) to have write and read permissions while the group and other classes have read only.</p>
<p>Congratulations that is the Linux and Unix file permissions and user classes in a nutshell. I hope it has not be too grueling and please feel free comment or ask any questions. Alternative articles on this subject can be found at the following links.</p>
<p>Ubuntu Community Pages: File Permissions<br />
<a class="vt-p" href="https://help.ubuntu.com/community/FilePermissions">https://help.ubuntu.com/community/FilePermissions</a></p>
<p>Zzee Linux Permissions Help<br />
<a class="vt-p" href="http://www.zzee.com/solutions/linux-permissions.shtml">http://www.zzee.com/solutions/linux-permissions.shtml</a></p>
<p>Mac-Terminal: Manage permission of files and folders in the Terminal for Mac OS X<br />
<a class="vt-p" href="http://www.mac-terminal.com/files-and-folders/permissions/">http://www.mac-terminal.com/files-and-folders/permissions/</a></p>
<br />Filed under: <a href='http://ipggi.wordpress.com/category/linux/'>Linux</a>, <a href='http://ipggi.wordpress.com/category/server-2/'>Server</a> Tagged: <a href='http://ipggi.wordpress.com/tag/block-special-files/'>block special files</a>, <a href='http://ipggi.wordpress.com/tag/character-special-files/'>character special files</a>, <a href='http://ipggi.wordpress.com/tag/chmod/'>chmod</a>, <a href='http://ipggi.wordpress.com/tag/chown/'>chown</a>, <a href='http://ipggi.wordpress.com/tag/classes/'>classes</a>, <a href='http://ipggi.wordpress.com/tag/command-line/'>command line</a>, <a href='http://ipggi.wordpress.com/tag/fifo/'>fifo</a>, <a href='http://ipggi.wordpress.com/tag/groups/'>groups</a>, <a href='http://ipggi.wordpress.com/tag/linux/'>Linux</a>, <a href='http://ipggi.wordpress.com/tag/ll/'>ll</a>, <a href='http://ipggi.wordpress.com/tag/ln/'>ln</a>, <a href='http://ipggi.wordpress.com/tag/ls/'>ls</a>, <a href='http://ipggi.wordpress.com/tag/mac-os/'>Mac OS</a>, <a href='http://ipggi.wordpress.com/tag/named-pipes/'>named pipes</a>, <a href='http://ipggi.wordpress.com/tag/octal-notion/'>octal notion</a>, <a href='http://ipggi.wordpress.com/tag/owner/'>owner</a>, <a href='http://ipggi.wordpress.com/tag/permission-bits/'>permission bits</a>, <a href='http://ipggi.wordpress.com/tag/permissions/'>permissions</a>, <a href='http://ipggi.wordpress.com/tag/symbolic-link/'>symbolic link</a>, <a href='http://ipggi.wordpress.com/tag/terminal/'>terminal</a>, <a href='http://ipggi.wordpress.com/tag/unix/'>unix</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ipggi.wordpress.com/639/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ipggi.wordpress.com/639/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=639&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ipggi.wordpress.com/2012/07/01/linux-file-permissions-and-user-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01aa96818e11d6d361d9832c957f8a0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ipggi</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/06/8-06-2012-11-12-49-am.png" medium="image">
			<media:title type="html">cd /boot &#124; ls</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/06/8-06-2012-11-14-21-am.png" medium="image">
			<media:title type="html">cd /boot &#124; ls -l original</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/06/8-06-2012-11-21-13-am2.png" medium="image">
			<media:title type="html">cd /boot &#124; ll coloured</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/06/8-06-2012-4-39-37-pm.png" medium="image">
			<media:title type="html">echo &#34;hello world&#34; &#62;&#62; hi</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/06/8-06-2012-5-30-09-pm.png" medium="image">
			<media:title type="html">mkinfo my-pipe</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/06/8-06-2012-5-36-47-pm.png" medium="image">
			<media:title type="html">ll /dev/sda*</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/07/30-06-2012-10-09-52-am-coloured.png" medium="image">
			<media:title type="html">echo &#34;&#34; &#62; file1 file2 - coloured</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/06/8-06-2012-5-54-37-pm.png" medium="image">
			<media:title type="html">cat /etc/passwd</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/06/8-06-2012-5-55-18-pm.png" medium="image">
			<media:title type="html">cat /etc/group</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/06/8-06-2012-5-53-49-pm.png" medium="image">
			<media:title type="html">coloured ll of ~</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/06/8-06-2012-7-00-55-pm.png" medium="image">
			<media:title type="html">file1 in detail</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/06/8-06-2012-6-50-54-pm.png" medium="image">
			<media:title type="html">blogdemo inb detail</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/06/30-06-2012-10-55-39-am.png" medium="image">
			<media:title type="html">mkdir bens_stuff and sudo mkdir roots_stuff</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/07/1-07-2012-11-54-49-am.png" medium="image">
			<media:title type="html">chmod -c go+r &#60;item&#62;</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/07/1-07-2012-12-00-57-pm.png" medium="image">
			<media:title type="html">chmod -c a=rwX *</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2012/07/1-07-2012-12-04-57-pm.png" medium="image">
			<media:title type="html">chmod 755 &#60;directory&#62;</media:title>
		</media:content>
	</item>
		<item>
		<title>Tuckey URLRewrite How-To</title>
		<link>http://ipggi.wordpress.com/2011/11/28/tuckey-urlrewrite-how-to/</link>
		<comments>http://ipggi.wordpress.com/2011/11/28/tuckey-urlrewrite-how-to/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 09:04:34 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[CFML/ColdFusion]]></category>
		<category><![CDATA[Railo]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[https enforcement]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[permanent redirection]]></category>
		<category><![CDATA[pretty url]]></category>
		<category><![CDATA[ses]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[tuckey]]></category>
		<category><![CDATA[url rewrite]]></category>
		<category><![CDATA[web filter]]></category>

		<guid isPermaLink="false">http://ipggi.wordpress.com/?p=635</guid>
		<description><![CDATA[Today I will walk through how to put into practice use the Tuckey URL Rewrite java web filter under an Apache Tomcat web server. URL rewriting is the method of converting complex URL parameters into more human readable format to allow more simple and memorable URLs. This can be an important function if you start [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=635&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Today I will walk through how to put into practice use the <a class="vt-p" href="http://www.tuckey.org/urlrewrite/">Tuckey URL Rewrite</a> java web filter under an <a class="vt-p" href="http://www.tomcat.apache.org/">Apache Tomcat</a> web server.</p>
<p>URL rewriting is the method of converting complex URL parameters into more human readable format to allow more simple and memorable URLs. This can be an important function if you start using frameworks or content management systems which automatically generate long and at times cryptic URLs. While URL rewrite on the more popular <a class="vt-p" href="httpd.apache.org">Apache HTTP Server</a> is relatively easy to set up using the default mod_rewrite module, reproducing this functionality on Tomcat requires a little more work.</p>
<p>Standard URL: <a class="vt-p" href="http://www.example.com/list.html?product=fruit&amp;page=1&amp;order=asc&amp;perpage=30">http://www.example.com/list.cfm?product=fruit&amp;page=1&amp;order=asc&amp;perpage=30</a><br />
Rewrite URL: <a class="vt-p" href="http://www.example.com/list/fruit/asc/30/1">http://www.example.com/list/fruit/asc/30/1</a></p>
<h2>Installation</h2>
<p><del datetime="2012-11-17T02:51:58+00:00">A downloadable copy of URLRewrite can be found from one of 2 sources. The outdated website at <a class="vt-p" href="http://www.tuckey.org/urlrewrite/">http://www.tuckey.org/urlrewrite/</a> lists version 3.2 as the most recent version. But there is a more recent and in my testing still stable 4.0 beta at Google Code <a class="vt-p" href="http://code.google.com/p/urlrewritefilter/downloads/list">http://code.google.com/p/urlrewritefilter/downloads/list</a> that contains some critical bug fixes. This article will assume you have downloaded the 4.0 beta and not the 3.2 stable.</del></p>
<p><ins datetime="2012-11-17T02:51:58+00:00">URLRewrite can be found from one of 2 sources. The official website at <a class="vt-p" href="http://www.tuckey.org/urlrewrite/">http://www.tuckey.org/urlrewrite/</a> the developer&#8217;s repository at Google Code <a class="vt-p" href="http://code.google.com/p/urlrewritefilter/downloads/list">http://code.google.com/p/urlrewritefilter/downloads/list</a>.</ins></p>
<p>Extracting the downloaded URLRewrite archive reveals a single <em>WEB-INF</em> folder which contains a <em>lib</em> folder and the file <em>urlrewrite.xml</em>. Both these items will need to be copied to the <em>WEB-INF</em> folder of your Tomcat server root directory. For example if example.com was located in <em>/var/www/www.example.com</em> or <em>c:\www\www.example.com</em> the <em>lib</em> folder and <em>urlrewrite.xml</em> would go in <em>/var/www/www.example.com/WEB-INF/</em> or<em> c:\www\www.example.com\WEB-INF</em>.</p>
<div id="attachment_684" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/11/28-11-2011-3-00-41-pm.png"><img class="size-medium wp-image-684" title="Content of Tuckey URLRewrite 4.0" alt="" src="http://ipggi.files.wordpress.com/2011/11/28-11-2011-3-00-41-pm.png?w=300&#038;h=50" height="50" width="300" /></a><p class="wp-caption-text">Content of Tuckey URLRewrite 4.0&#8242;s archive</p></div>
<div id="attachment_687" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/11/28-11-2011-3-06-46-pm.png"><img class="size-medium wp-image-687" title="Content of WEB-INF" alt="" src="http://ipggi.files.wordpress.com/2011/11/28-11-2011-3-06-46-pm.png?w=300&#038;h=52" height="52" width="300" /></a><p class="wp-caption-text">Content of WEB-INF with URLRewrite</p></div>
<div id="attachment_685" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/11/28-11-2011-4-05-39-pm.png"><img class="size-medium wp-image-685" title="Content Of A Clean WEB.XML" alt="" src="http://ipggi.files.wordpress.com/2011/11/28-11-2011-4-05-39-pm.png?w=300&#038;h=57" height="57" width="300" /></a><p class="wp-caption-text">Content Of A Clean WEB.XML</p></div>
<p>Generally for most default installations of Tomcat the <em>WEB-INF</em> folder will only contain the single file <em>web.xml</em>. We will need to edit<em> web.xml</em> using a text editor to enable URLRewrite on Tomcat but because it is an XML text file. It can be machined parsed so I&#8217;d recommend editing it using a source code text editor such as <a class="vt-p" href="http://www.notepad-plus-plus.org/">NotePad++</a> on Windows or <a class="vt-p" href="http://www.macromates.com/">Textmate </a>on OS/X.</p>
<p>Add the following code to <em>web.xm</em>l anywhere contained within the <em>&lt;web-app&gt;&lt;/web-app&gt;</em> tags.<br />
<code><br />
&lt;!-- URL ReWriter --&gt;<br />
&lt;filter&gt;<br />
&lt;filter-name&gt;UrlRewriteFilter&lt;/filter-name&gt;<br />
&lt;filter-class&gt;org.tuckey.web.filters.urlrewrite.UrlRewriteFilter&lt;/filter-class&gt;<br />
&lt;!-- set the amount of seconds the conf file will be checked for reload<br />
can be a valid integer (0 denotes check every time,<br />
empty/not set denotes no reload check) --&gt;<br />
&lt;init-param&gt;<br />
&lt;param-name&gt;confReloadCheckInterval&lt;/param-name&gt;<br />
&lt;param-value&gt;0&lt;/param-value&gt;<br />
&lt;/init-param&gt;<br />
&lt;!-- you can disable status page if desired<br />
can be: true, false (default true) --&gt;<br />
&lt;init-param&gt;<br />
&lt;param-name&gt;statusEnabled&lt;/param-name&gt;<br />
&lt;param-value&gt;true&lt;/param-value&gt;<br />
&lt;/init-param&gt;<br />
&lt;init-param&gt;<br />
&lt;param-name&gt;logLevel&lt;/param-name&gt;<br />
&lt;param-value&gt;DEBUG&lt;/param-value&gt;<br />
&lt;/init-param&gt;<br />
&lt;init-param&gt;<br />
&lt;param-name&gt;statusEnabledOnHosts&lt;/param-name&gt;<br />
&lt;param-value&gt;localhost&lt;/param-value&gt;<br />
&lt;/init-param&gt;<br />
&lt;/filter&gt;</code></p>
<p><code>&lt;filter-mapping&gt;<br />
&lt;filter-name&gt;UrlRewriteFilter&lt;/filter-name&gt;<br />
&lt;url-pattern&gt;/*&lt;/url-pattern&gt;<br />
&lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;<br />
&lt;dispatcher&gt;FORWARD&lt;/dispatcher&gt;<br />
&lt;/filter-mapping&gt;</code></p>
<div id="attachment_686" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/11/28-11-2011-7-21-44-pm.png"><img class="size-medium wp-image-686" title="Edited WEB.XML" alt="" src="http://ipggi.files.wordpress.com/2011/11/28-11-2011-7-21-44-pm.png?w=300&#038;h=278" height="278" width="300" /></a><p class="wp-caption-text">Edited WEB.XML</p></div>
<p>Let&#8217;s quickly go through these settings.</p>
<p><em><strong>confReloadCheckInterval</strong></em> is a numeric value in seconds that tells how frequently URLRewrite should check your <em>urlrewrite.xml</em> rules for any changes. Normally with Tomcat the modification of an XML configuration file requires a restart before the changes are reflected. You can set this value to <strong>-1</strong> to disable automatic checking, while our value of <strong>0</strong> will mean that URLRewrite will check the<em> urlrewrite.xml</em> on every HTTP request. It is a great setting while testing and developing but a resource waste if used on a production server.</p>
<p><strong><em>statusEnabled</em></strong> is a Boolean value that enables a URLRewrite status page that is reachable via a web browser at <a class="vt-p" href="http://www.example.com/rewrite-status">http://www.example.com/rewrite-status</a>. It is probably best to disable this feature on production servers.</p>
<p><em><strong>logLevel</strong></em> sets how much logging should be produced by URLRewrite. While the default setting is <strong>INFO</strong>, I suggest using <strong>DEBUG</strong> while you are testing. Through in a production environment you will probably want to use <strong>ERROR</strong> or <strong>FATAL</strong> to limit logging as URLRewrite can generate some large log files very quickly with more verbose log settings.</p>
<p><em><strong>statusEnabledOnHosts</strong></em> allows you set which IP addresses and hosts that have access to the URLRewrite status page previously mentioned.</p>
<p>Finally the <em>&lt;filer-mapping&gt;</em> tag tells what kinds of methods to pass through via URLRewrite. The tags <em>&lt; url-pattern &gt;&lt;/ url-pattern&gt;</em> should be left as is to apply URLRewrite to the whole site. While the 2 <em>&lt; dispatcher &gt;&lt;/ dispatcher &gt;</em> tags mean that URLRewrite should be used for all HTTP REQUESTS and HTTP internal FORWARDing.</p>
<p>Once done, save your web.xml file and restart your Tomcat server. If all goes well you should be able to point your browser to <a class="vt-p" href="http://www.example.com/rewrite-status">http://www.example.com/rewrite-status</a> and an <strong>UrlRewriteFilter 3.2.0 build 1 configuration</strong> overview should be shown. Yes that 3.2 version number is incorrectly listed in 4.0. Point your browser to <a class="vt-p" href="http://www.example.com/test/status/">http://www.example.com/test/status/</a> and you should be automatically forwarded to <em>/rewrite-status</em>. When this works then congratulations as you now have URLRewrite enabled on your server. Now I will give you some helpful example rules that may come in use. These rules all go in-between the <em>&lt;urlrewrite&gt;&lt;/urlrewrite&gt;</em> tags located in the <em>urlrewrite.xml</em> file within the <em>WEB-INF</em> folder. Whenever a page is requested on your Tomcat server the URLRewrite application will in a sequential order process ALL the rules contained in the <em>urlrewrite.xml</em>.</p>
<h2>Pretty URL, SES Friendly URL Pass-Through</h2>
<p>The most common use of URLRewrite would probably be to enable a 3rd party framework or CMS to use pretty URLs. The rule below is a generic setup that could be adapted for many uses. Generally speaking this should always be the LAST rule listed in your urlrewrite.xml rule set. The rule passes all URL requests to the <em>index.cfm</em> file except requests with URLs pointing to files or folders listed in the <em>&lt;condition&gt;&lt;/condition&gt; </em>tag regular expression value. So with this rule the URL <a class="vt-p" href="http://www.example.com/list/apples">http://www.example.com/list/apples</a> would be displayed as is in the user&#8217;s browser but URLRewrite will actually pass <a class="vt-p" href="http://www.example.com/index.cfm/list/apples">http://www.example.com/index.cfm/list/apples</a> to the Tomcat server. You do want to make sure that the page that contained within the <em>&lt;to&gt;&lt;/to&gt; </em>tag value is also listed in the (not equal) <em>&lt;condition&gt;&lt;/condition&gt;</em> value otherwise you could run into an infinite loop.</p>
<p><code>&lt;rule enabled="true"&gt;<br />
&lt;name&gt;Generic Pretty URLs Pass-through&lt;/name&gt;<br />
&lt;condition type="request-uri" operator="notequal"&gt;^/(index.cfm|robots.txt|osd.xml|flex2gateway|cfide|cfformgateway|railo-context|admin-context|files|images|jrunscripts|javascripts|miscellaneous|stylesheets)&lt;/condition&gt;<br />
&lt;from&gt;^/(.*)$&lt;/from&gt;<br />
&lt;to type="passthrough"&gt;/index.cfm/$1&lt;/to&gt;<br />
&lt;/rule&gt;</code></p>
<h2>Permanent Redirection</h2>
<p>This rule is specifically for when you want to do a permanent redirection using the HTTP code 301. If we break this rule down, the <em>&lt;rule enable=&#8221;"&gt;</em> Boolean enables you to selectively turn off this rule without the need to comment it out. The<em> &lt;name&gt;&lt;/name&gt;</em> tags contains the label you wish to use to describe the rule. <em>&lt;from&gt;&lt;/from&gt;</em> tag contains a regular expression to forward all requests for the <em>documents.cfm</em> page plus any URL parameters. While <em>&lt;to&gt;&lt;/to&gt;</em> is the new URL to redirect to. The attribute type tells URLRewrite to send a permanent direct code to the browser requesting the URL, while the attribute <em>last = </em><strong>true</strong> tells URLRewrite not to process any further rules for this page request.</p>
<p><code>&lt;rule enabled="true"&gt;<br />
&lt;name&gt;Permanent redirect example&lt;/name&gt;<br />
&lt;from&gt;^/documents.html(.*)$&lt;/from&gt;<br />
&lt;to type="permanent-redirect" last="true"&gt;/file/list/document&lt;/to&gt;<br />
&lt;/rule&gt;</code></p>
<h2>Selective HTTPS Enforcement</h2>
<p>If you have HTTPS setup on your server you can use URLRewrite to enforce certain folders, URL paths or files to only be served on an encrypted HTTPS protocol. The <em>&lt;condition&gt;&lt;/condition&gt;</em> tag is used to enforce additional policies as to when the rule should be implemented. The attribute <em>type</em> with a value of <strong>scheme</strong> and the attribute <em>operator</em> with a value of <strong>equal</strong> states that when the URL scheme (http, https, ftp, etc) is equal to <strong>HTTP</strong> then apply this rule.</p>
<p><code>&lt;rule enabled="false"&gt;<br />
&lt;name&gt;Force HTTPS example&lt;/name&gt;<br />
&lt;note&gt;Automatically redirects adminstration requests to a secure protocol.&lt;/note&gt;<br />
&lt;condition type="scheme" operator="equal"&gt;^http$&lt;/condition&gt;<br />
&lt;from&gt;^/CFIDE/administrator/(.*)$&lt;/from&gt;<br />
&lt;to type="permanent-redirect" last="true"&gt;<a href="https://www.example.com/CFIDE/administrator/$1&lt;/to&#038;gt" rel="nofollow">https://www.example.com/CFIDE/administrator/$1&lt;/to&#038;gt</a>;<br />
&lt;/rule&gt;</code></p>
<h2>Railo HTTPS Enforcement railo-content.</h2>
<p><code>&lt;rule enabled="false"&gt;<br />
&lt;name&gt;Force HTTPS example&lt;/name&gt;<br />
&lt;note&gt;Automatically redirects adminstration requests to a secure protocol.&lt;/note&gt;<br />
&lt;condition type="scheme" operator="equal"&gt;^http$&lt;/condition&gt;<br />
&lt;from&gt;^/railo-context/admin/(index|web|server).cfm$&lt;/from&gt;<br />
&lt;to type="permanent-redirect" last="true"&gt;<a href="https://www.example.com/railo-context/admin/$1.cfm&lt;/to&#038;gt" rel="nofollow">https://www.example.com/railo-context/admin/$1.cfm&lt;/to&#038;gt</a>;<br />
&lt;/rule&gt;</code></p>
<h2>Conditions Based On URL Parameters</h2>
<p>You can also apply conditions to user supplied URL parameters. In the example below the condition looks for the URL parameter named fruit and sees if its value is either kiwi, apple or orange. If the values match then it redirects to a replacement URL which also incorporates the parameter. The URL request <a class="vt-p" href="http://www.example.com/list.html?fruit=apple">http://www.example.com/list.html?fruit=apple</a> would forward to <a class="vt-p" href="http://www.example.com/list/fruit/apple">http://www.example.com/list/fruit/apple</a>.</p>
<p><code>&lt;rule enabled="true"&gt;<br />
&lt;name&gt;Selective fruit example redirect&lt;/name&gt;<br />
&lt;condition type="parameter" name="fruit" operator="equal"&gt;(apple|kiwi|orange)&lt;/condition&gt;<br />
&lt;from&gt;^/list.html(.*)$&lt;/from&gt;<br />
&lt;to type="permanent-redirect" last="true"&gt;list/fruit/%{parameter:fruit}&lt;/to&gt;<br />
&lt;/rule&gt;</code></p>
<br />Filed under: <a href='http://ipggi.wordpress.com/category/cfmlcoldfusion/'>CFML/ColdFusion</a>, <a href='http://ipggi.wordpress.com/category/cfmlcoldfusion/railo/'>Railo</a>, <a href='http://ipggi.wordpress.com/category/server-2/'>Server</a>, <a href='http://ipggi.wordpress.com/category/tomcat-2/'>Tomcat</a> Tagged: <a href='http://ipggi.wordpress.com/tag/apache/'>apache</a>, <a href='http://ipggi.wordpress.com/tag/https-enforcement/'>https enforcement</a>, <a href='http://ipggi.wordpress.com/tag/java/'>java</a>, <a href='http://ipggi.wordpress.com/tag/permanent-redirection/'>permanent redirection</a>, <a href='http://ipggi.wordpress.com/tag/pretty-url/'>pretty url</a>, <a href='http://ipggi.wordpress.com/tag/railo/'>Railo</a>, <a href='http://ipggi.wordpress.com/tag/ses/'>ses</a>, <a href='http://ipggi.wordpress.com/tag/tomcat/'>tomcat</a>, <a href='http://ipggi.wordpress.com/tag/tuckey/'>tuckey</a>, <a href='http://ipggi.wordpress.com/tag/url-rewrite/'>url rewrite</a>, <a href='http://ipggi.wordpress.com/tag/web-filter/'>web filter</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ipggi.wordpress.com/635/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ipggi.wordpress.com/635/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=635&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ipggi.wordpress.com/2011/11/28/tuckey-urlrewrite-how-to/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01aa96818e11d6d361d9832c957f8a0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ipggi</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/11/28-11-2011-3-00-41-pm.png?w=300" medium="image">
			<media:title type="html">Content of Tuckey URLRewrite 4.0</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/11/28-11-2011-3-06-46-pm.png?w=300" medium="image">
			<media:title type="html">Content of WEB-INF</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/11/28-11-2011-4-05-39-pm.png?w=300" medium="image">
			<media:title type="html">Content Of A Clean WEB.XML</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/11/28-11-2011-7-21-44-pm.png?w=300" medium="image">
			<media:title type="html">Edited WEB.XML</media:title>
		</media:content>
	</item>
		<item>
		<title>Embed a Railo ColdFusion/CFML Server within your CFEclipse/Eclipse application with no need for XML configurations.</title>
		<link>http://ipggi.wordpress.com/2011/10/07/embed-a-railo-coldfusioncfml-server-within-your-cfeclipseeclipse-application-with-no-need-for-xml-configurations/</link>
		<comments>http://ipggi.wordpress.com/2011/10/07/embed-a-railo-coldfusioncfml-server-within-your-cfeclipseeclipse-application-with-no-need-for-xml-configurations/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 02:00:23 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[CFML/ColdFusion]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Railo]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[cfeclipse]]></category>
		<category><![CDATA[cfml]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://ipggi.wordpress.com/?p=644</guid>
		<description><![CDATA[This entry will walk you through step by step to enable you from within Eclipse to start and shutdown a custom install of the open source CFML engine Railo running off Apache Tomcat. Most importantly though you will be able to implement this without the need of touching any fickle XML Tomcat configuration files. This [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=644&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This entry will walk you through step by step to enable you from within Eclipse to start and shutdown a custom install of the open source CFML engine Railo running off Apache Tomcat. Most importantly though you will be able to implement this without the need of touching any fickle XML Tomcat configuration files.</p>
<p>This article was written in mind with the CFEclipse add-on running off Eclipse Helios. I have not tested these steps with Adobe’s proprietary CFBuilder.</p>
<p>Eclipse: <a class="vt-p" href="http://www.eclipse.org/downloads/compare.php">http://www.eclipse.org/downloads/compare.php</a><br />
CFEclipse: <a class="vt-p" href="http://cfeclipse.org/">http://cfeclipse.org</a></p>
<p>Let’s start.</p>
<p>Visit Apache Tomcat and download your appropriate edition under the <strong>Core</strong> section. Windows users should download either the 32-bit or 64-bit Windows zip but <span style="text-decoration:underline;">not</span> the Service Installer.</p>
<p>Tomcat 7: <a class="vt-p" href="http://tomcat.apache.org/download-70.cgi">http://tomcat.apache.org/download-70.cgi<br />
</a>Tomcat 6: <a class="vt-p" href="http://tomcat.apache.org/download-60.cgi">http://tomcat.apache.org/download-60.cgi</a></p>
<p>Extract the downloaded zip containing Apache and then move the created <code>apache-tomcat-7.*.*</code> directory to a location of your choice. In this example I will move it to my server collection under <code>W:\Dev\Server\</code>.</p>
<p>Go to the Railo download page and fetch the latest <strong>Current stable</strong> release <strong>Railo Custom WAR Archive</strong> under the <strong>ALL OS</strong>.</p>
<p>Railo: <a class="vt-p" href="http://www.getrailo.org/index.cfm/download">http://www.getrailo.org/index.cfm/download</a></p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/5-10-2011-10-36-30-am.png"><img class="alignnone size-medium wp-image-647" title="railo war download" src="http://ipggi.files.wordpress.com/2011/10/5-10-2011-10-36-30-am.png?w=300&#038;h=186" alt="" width="300" height="186" /></a></p>
<p>Using 7-Zip or some other WAR compatible archive tool extract the downloaded <code>Railo-3.*.*</code> WAR archive.</p>
<p>7-Zip: <a class="vt-p" href="http://www.7-zip.org">http://www.7-zip.org</a></p>
<p>Now create a working resource directory for your CFEclipse project. I will use <code>W:\Railo\Test\</code>.</p>
<p>Copy the content of the extracted WAR archive to your project resource directory.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/7-10-2011-11-03-34-am.png"><img class="size-medium wp-image-648" title="content of w:\railo\test\&quot; width=" src="http://ipggi.files.wordpress.com/2011/10/7-10-2011-11-03-34-am.png?w=300" alt="" height="159" /></a></p>
<p>Start Eclipse.</p>
<p>From the pull-down menu select <strong>Window &gt; Preferences </strong>then<strong> Server &gt; Runtime Environment</strong> and select <strong>Add</strong>.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/5-10-2011-11-05-54-am.png"><img class="alignnone size-medium wp-image-649" title="windows preferences server runtime" src="http://ipggi.files.wordpress.com/2011/10/5-10-2011-11-05-54-am.png?w=300&#038;h=261" alt="" width="300" height="261" /></a></p>
<p>In the <strong>New Server Runtime Environment</strong> dialog select your appropriate Apache Tomcat version and select <strong>Next &gt;</strong>. If you cannot see an Apache folder containing various Tomcat versions you will need to click the <strong>Download additional server adapters</strong> link and follow the <strong>Install New Extension</strong> wizard.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/5-10-2011-11-06-23-am.png"><img class="alignnone size-medium wp-image-650" title="new runtime environment" src="http://ipggi.files.wordpress.com/2011/10/5-10-2011-11-06-23-am.png?w=285&#038;h=300" alt="" width="285" height="300" /></a></p>
<p>Give your<strong> Tomcat Server</strong> a <strong>name</strong> and point it to your <strong>Tomcat installation directory</strong>.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/5-10-2011-11-34-27-am.png"><img class="alignnone size-medium wp-image-651" title="new server runtime environment" src="http://ipggi.files.wordpress.com/2011/10/5-10-2011-11-34-27-am.png?w=285&#038;h=300" alt="" width="285" height="300" /></a></p>
<p>Click the <strong>Installed JREs&#8230;</strong> button and in the <strong>Installed JREs</strong> dialog select <strong>Add</strong>. In the <strong>Add JRE</strong> wizard select <strong>Add</strong> and point the <strong>JRE home:</strong> input to your local Java Runtime Environment location. This is often either <code>C:\Program Files\Java\jre6</code> or <code>C:\Program Files (x86)\Java\jre6</code>. If you downloaded the 64-bit edition of Tomcat you will need to point to the 64-bit Java RE that is installed on your machine. Once done select the <strong>Finish</strong> button and then the <strong>OK</strong> button in the <strong>Installed JREs</strong> dialog.</p>
<p>Java Runtime Environment: <a class="vt-p" href="http://java.com/en/download/manual.jsp">http://java.com/en/download/manual.jsp</a></p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/5-10-2011-11-14-50-am.png"><img class="alignnone size-medium wp-image-652" title="add jre" src="http://ipggi.files.wordpress.com/2011/10/5-10-2011-11-14-50-am.png?w=292&#038;h=300" alt="" width="292" height="300" /></a></p>
<p>Now make sure the <strong>New Server Runtime Environment</strong> has your installed JRE selected and <span style="text-decoration:underline;">not</span> the Workbench default JRE and press <strong>Finish</strong>. Press <strong>OK</strong> in the<strong> Server Runtime Environments</strong> dialog.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/jre-selection1.png"><img class="alignnone size-medium wp-image-654" title="jre selection" src="http://ipggi.files.wordpress.com/2011/10/jre-selection1.png?w=285&#038;h=300" alt="" width="285" height="300" /></a></p>
<p>Now we need to bring up the Eclipse Servers view. From the Eclipse pull-down menu select <strong>Window</strong> &gt; <strong>Show View</strong> &gt; <strong>Other</strong> &gt; <strong>Server</strong> &gt; <strong>Servers </strong>and press<strong> OK</strong>. The <strong>Servers</strong> tab should now be selected, right click on the <strong>Servers</strong> pane and select <strong>New</strong> &gt; <strong>Server</strong>.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/servers-right-click.png"><img class="alignnone size-medium wp-image-655" title="servers right click" src="http://ipggi.files.wordpress.com/2011/10/servers-right-click.png?w=300&#038;h=115" alt="" width="300" height="115" /></a></p>
<p>In the <strong>Define a New Server</strong> dialog select your Apache Tomcat server type. Give the server a <strong>Server name</strong>, keep the host name as <em>localhost</em>, make sure the <strong>Server runtime environment</strong> is correct and select <strong>Finish</strong>.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/define-a-new-server1.png"><img class="alignnone size-medium wp-image-657" title="define a new server" src="http://ipggi.files.wordpress.com/2011/10/define-a-new-server1.png?w=284&#038;h=300" alt="" width="284" height="300" /></a></p>
<p>You should have a new entry in your <strong>Servers</strong> tab. Double left-click it to bring up the server’s <strong>Overview</strong> tab.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/servers-double-left-click.png"><img class="alignnone size-medium wp-image-658" title="servers double left click" src="http://ipggi.files.wordpress.com/2011/10/servers-double-left-click.png?w=300&#038;h=67" alt="" width="300" height="67" /></a></p>
<p>Under <strong>Server Locations</strong> select the <strong>Use Tomcat installation</strong> option. The <strong>Deploy path</strong> should be set to <em>webapps</em> and then save the changes using Ctrl-S.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/server-overview1.png"><img class="alignnone size-medium wp-image-660" title="server overview" src="http://ipggi.files.wordpress.com/2011/10/server-overview1.png?w=247&#038;h=300" alt="" width="247" height="300" /></a></p>
<p>Now select the <strong>Modules</strong> tab in the <strong>Overview</strong> and press the <strong>Add External Web Module&#8230;</strong> button. Point the <strong>document base</strong> to your Railo working resource directory in my case it is <code>W:\Railo\Test\</code> but keep the <strong>path</strong> as <code>/</code> and press <strong>OK</strong>. Save the updated Web Modules using Ctrl-S.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/web-modules.png"><img class="alignnone size-medium wp-image-661" title="web modules" src="http://ipggi.files.wordpress.com/2011/10/web-modules.png?w=300&#038;h=152" alt="" width="300" height="152" /></a></p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/add-web-module.png"><img class="alignnone size-medium wp-image-662" title="add web module" src="http://ipggi.files.wordpress.com/2011/10/add-web-module.png?w=300&#038;h=188" alt="" width="300" height="188" /></a></p>
<p>Back to the <strong>Servers</strong> tab select your server, right click and select <strong>Start</strong>. Eclipse should automatically switch tabs to the <strong>Console</strong> as the server starts before reverting you back to the <strong>Servers</strong>. The server should have a revised status saying <em>Started, Synchronized</em>.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/start-server.png"><img class="alignnone size-medium wp-image-663" title="start server" src="http://ipggi.files.wordpress.com/2011/10/start-server.png?w=300&#038;h=285" alt="" width="300" height="285" /></a></p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/server-started-synchronized-status.png"><img class="alignnone size-medium wp-image-664" title="server started synchronized status" src="http://ipggi.files.wordpress.com/2011/10/server-started-synchronized-status.png?w=300&#038;h=31" alt="" width="300" height="31" /></a></p>
<p>Point your web browser to <a class="vt-p" href="http://localhost:8080/">http://localhost:8080/</a>and you should have the Railo Welcome page. To shut down your server select it under the Eclipse <strong>Servers</strong> tab, right-click and select <strong>Stop</strong>. Congratulations you have a working embedded Tomcat Railo server operating within Eclipse.</p>
<p>Next we will create a CFEclipse project and a simple <em>Hello World</em> application otherwise you can end the tutorial here.</p>
<p>In Eclipse pull-down <strong>Window</strong> and select <strong>Show View</strong> &gt; <strong>Project Explorer</strong>.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/5-10-2011-10-58-09-am.png"><img class="alignnone size-medium wp-image-665" title="select project explorer" src="http://ipggi.files.wordpress.com/2011/10/5-10-2011-10-58-09-am.png?w=300&#038;h=269" alt="" width="300" height="269" /></a></p>
<p>Right click on the <strong>Project Explorer</strong> pane and select <strong>New</strong> &gt; <strong>Project</strong> to bring up the <strong>New Project</strong> wizard. Open the <strong>CFEclipse</strong> folder and selected <strong>CFML Project</strong> and press <strong>Next</strong>.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/project-explorer-new-project.png"><img class="alignnone size-medium wp-image-666" title="project explorer new project" src="http://ipggi.files.wordpress.com/2011/10/project-explorer-new-project.png?w=300&#038;h=223" alt="" width="300" height="223" /></a></p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/new-cfml-project.png"><img class="alignnone size-medium wp-image-667" title="new cfml project" src="http://ipggi.files.wordpress.com/2011/10/new-cfml-project.png?w=205&#038;h=300" alt="" width="205" height="300" /></a></p>
<p>Give your CFEclipse Project a <strong>Project name</strong> and then <span style="text-decoration:underline;">deselect</span> the <strong>Use default location</strong> checkbox. Select the location of your working resource directory where you placed your Railo installation. For me it was <code>W:\Railo\Test\</code> and then <strong>Finish</strong>.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/new-cfeclipse-project-wizard.png"><img class="alignnone size-medium wp-image-668" title="new cfeclipse project wizard" src="http://ipggi.files.wordpress.com/2011/10/new-cfeclipse-project-wizard.png?w=300&#038;h=204" alt="" width="300" height="204" /></a></p>
<p>Open your newly created project from the <strong>Project Explorer</strong>, right-click and select <strong>New</strong> &gt; <strong>File</strong>. Create a new file named hello.cfm in your project and <strong>Finish</strong>. Edit the hello.cfm and add the following mark-up and save using Ctrl-S.</p>
<p>&lt;cfdump var=&#8221;Hello world!&#8221;&gt;</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/open-project.png"><img class="alignnone size-full wp-image-669" title="open project" src="http://ipggi.files.wordpress.com/2011/10/open-project.png?w=620" alt=""   /></a></p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/5-10-2011-12-37-49-pm.png"><img class="alignnone size-medium wp-image-670" title="new file wizard" src="http://ipggi.files.wordpress.com/2011/10/5-10-2011-12-37-49-pm.png?w=274&#038;h=300" alt="" width="274" height="300" /></a></p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/hello-world-code.png"><img class="alignnone size-full wp-image-671" title="hello world code" src="http://ipggi.files.wordpress.com/2011/10/hello-world-code.png?w=620" alt=""   /></a></p>
<p>In the<strong> Servers</strong> tab start your server. Once it has loaded select from the Eclipse pull-down menu <strong>Window</strong> and then <strong>Show View</strong> &gt; <strong>Browser View</strong>. Under the <strong>Project browser </strong>tab enter the URL <a class="vt-p" href="http://localhost:8080/hello.cfm">http://localhost:8080/hello.cfm</a> and you should see a dump of text <em>Hello world!</em>.</p>
<p><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/10/hello-world-output.png"><img class="alignnone size-medium wp-image-672" title="hello world output" src="http://ipggi.files.wordpress.com/2011/10/hello-world-output.png?w=300&#038;h=167" alt="" width="300" height="167" /></a></p>
<p>Now you are ready to develop, test and troubleshoot your ColdFusion Mark-up all contained within the Eclipse environment.</p>
<br />Filed under: <a href='http://ipggi.wordpress.com/category/cfmlcoldfusion/'>CFML/ColdFusion</a>, <a href='http://ipggi.wordpress.com/category/eclipse/'>Eclipse</a>, <a href='http://ipggi.wordpress.com/category/cfmlcoldfusion/railo/'>Railo</a> Tagged: <a href='http://ipggi.wordpress.com/tag/apache/'>apache</a>, <a href='http://ipggi.wordpress.com/tag/cfeclipse/'>cfeclipse</a>, <a href='http://ipggi.wordpress.com/tag/cfml/'>cfml</a>, <a href='http://ipggi.wordpress.com/tag/tomcat/'>tomcat</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ipggi.wordpress.com/644/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ipggi.wordpress.com/644/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=644&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ipggi.wordpress.com/2011/10/07/embed-a-railo-coldfusioncfml-server-within-your-cfeclipseeclipse-application-with-no-need-for-xml-configurations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01aa96818e11d6d361d9832c957f8a0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ipggi</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/5-10-2011-10-36-30-am.png?w=300" medium="image">
			<media:title type="html">railo war download</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/7-10-2011-11-03-34-am.png?w=300" medium="image">
			<media:title type="html">content of w:\railo\test\&#34; width=</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/5-10-2011-11-05-54-am.png?w=300" medium="image">
			<media:title type="html">windows preferences server runtime</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/5-10-2011-11-06-23-am.png?w=285" medium="image">
			<media:title type="html">new runtime environment</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/5-10-2011-11-34-27-am.png?w=285" medium="image">
			<media:title type="html">new server runtime environment</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/5-10-2011-11-14-50-am.png?w=292" medium="image">
			<media:title type="html">add jre</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/jre-selection1.png?w=285" medium="image">
			<media:title type="html">jre selection</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/servers-right-click.png?w=300" medium="image">
			<media:title type="html">servers right click</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/define-a-new-server1.png?w=284" medium="image">
			<media:title type="html">define a new server</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/servers-double-left-click.png?w=300" medium="image">
			<media:title type="html">servers double left click</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/server-overview1.png?w=247" medium="image">
			<media:title type="html">server overview</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/web-modules.png?w=300" medium="image">
			<media:title type="html">web modules</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/add-web-module.png?w=300" medium="image">
			<media:title type="html">add web module</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/start-server.png?w=300" medium="image">
			<media:title type="html">start server</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/server-started-synchronized-status.png?w=300" medium="image">
			<media:title type="html">server started synchronized status</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/5-10-2011-10-58-09-am.png?w=300" medium="image">
			<media:title type="html">select project explorer</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/project-explorer-new-project.png?w=300" medium="image">
			<media:title type="html">project explorer new project</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/new-cfml-project.png?w=205" medium="image">
			<media:title type="html">new cfml project</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/new-cfeclipse-project-wizard.png?w=300" medium="image">
			<media:title type="html">new cfeclipse project wizard</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/open-project.png" medium="image">
			<media:title type="html">open project</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/5-10-2011-12-37-49-pm.png?w=274" medium="image">
			<media:title type="html">new file wizard</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/hello-world-code.png" medium="image">
			<media:title type="html">hello world code</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/10/hello-world-output.png?w=300" medium="image">
			<media:title type="html">hello world output</media:title>
		</media:content>
	</item>
		<item>
		<title>Cygwin Walkthrough and Beginners Guide &#8211; Is it Linux for Windows or a POSIX Compatible Alternative To PowerShell?</title>
		<link>http://ipggi.wordpress.com/2011/07/01/cygwin-walkthrough-and-beginners-guide-is-it-linux-for-windows-or-a-posix-compatible-alternative-to-powershell/</link>
		<comments>http://ipggi.wordpress.com/2011/07/01/cygwin-walkthrough-and-beginners-guide-is-it-linux-for-windows-or-a-posix-compatible-alternative-to-powershell/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 03:30:18 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[cygwin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[posix]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://ipggi.wordpress.com/?p=590</guid>
		<description><![CDATA[Linux in Windows? Cygwin is an awesome tool for agnostic operating system users who regularly use both Windows and Linux but want the power of a Linux shell and its tools running within Windows. It is a great replacement to the primitive Windows command prompt without the need to learn a new collection of commands [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=590&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<h2>Linux in Windows?</h2>
<p>Cygwin is an awesome tool for agnostic operating system users who regularly use both Windows and Linux but want the power of a Linux shell and its tools running within Windows. It is a great replacement to the primitive Windows command prompt without the need to learn a new collection of commands or a new scripting language. A requirement which is needed for the Microsoft developed and recommended command prompt alternative PowerShell.</p>
<p>Cygwin is <a class="vt-p" href="http://en.wikipedia.org/wiki/POSIX">POSIX</a> (Portable Operating System Interface for uniX) complaint which basically means it shares a common API with all the other complaint operating systems. It does not mean applications compiled for other POSIX systems such as Linux software will automatically work within Cygwin. To add new POSIX software you still need to compile the software source code under Cygwin using its own compilers and libraries. This process is a requirement with most POSIX complaint operating systems e.g. software complied for FreeBDS (Unix) will not work under Debian/Ubuntu (Linux).</p>
<p>Cygwin will work on any x86 32-bit or x86-64 editions of Windows NT from NT 4.0 Service Pack 4 (1998) onwards to Windows 7 including 2000, 2003, 2008, XP and Vista. There is no support for the Windows 16/32-bit hybrids such as 95, 98 or ME.</p>
<h2>Installation</h2>
<p>So let&#8217;s get started. Visit <a class="vt-p" href="http://cygwin.com/install.html">http://cygwin.com/install.html</a>, download then run the <em>setup.exe</em>. This file is a Windows based package manager for Cygwin. By default it will download and install the latest minimal install of Cygwin but on future launches it will also enable you to add new packages and update your existing Cygwin software. So after you install Cygwin do not delete or loose the location of <em>setup.exe</em>!</p>
<div id="attachment_600" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/cygwin-net-release-setup-program.png"><img class="size-medium wp-image-600" title="cygwin net release setup program" alt="" src="http://ipggi.files.wordpress.com/2011/06/cygwin-net-release-setup-program.png?w=300&#038;h=219" width="300" height="219" /></a><p class="wp-caption-text">Cygwin Net Release Setup Program (setup.exe).</p></div>
<div id="attachment_594" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/choose-a-download-source.png"><img class="size-medium wp-image-594" title="choose a download source" alt="" src="http://ipggi.files.wordpress.com/2011/06/choose-a-download-source.png?w=300&#038;h=219" width="300" height="219" /></a><p class="wp-caption-text">For Choose A Download Source select Install from Internet.</p></div>
<div id="attachment_610" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/select-root-install-directory.png"><img class="size-medium wp-image-610" title="Select Root Install Directory" alt="" src="http://ipggi.files.wordpress.com/2011/06/select-root-install-directory.png?w=300&#038;h=219" width="300" height="219" /></a><p class="wp-caption-text">Select Root Install Directory.</p></div>
<p>By default Cygwin will install to <em>C:\cygwin</em> but you can change this to any directory of your choosing. It is highly recommended that you do not choose a directory path which contains spaces in the name, so both <em>C:\Program Files\cygwin</em> or <em>C:\Program Files (x86)\cygwin</em> are out.</p>
<div id="attachment_608" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/select-local-package-directory.png"><img class="size-medium wp-image-608" title="select local package directory" alt="" src="http://ipggi.files.wordpress.com/2011/06/select-local-package-directory.png?w=300&#038;h=219" width="300" height="219" /></a><p class="wp-caption-text">Select Local Package Directory.</p></div>
<p>Cygwin setup will save all downloaded packages to this folder after it has finished installation. You can then either delete them, leave them in this directory or back them up to a USB stick for future use on this or other computers.</p>
<div id="attachment_611" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/select-your-internet-connection.png"><img class="size-medium wp-image-611" title="select your internet connection" alt="" src="http://ipggi.files.wordpress.com/2011/06/select-your-internet-connection.png?w=300&#038;h=219" width="300" height="219" /></a><p class="wp-caption-text">Select Your Internet Connection.</p></div>
<p>Unless otherwise needed you should leave the Internet connected selection with the default selection of Direct Connection.</p>
<div id="attachment_593" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/choose-a-download-site.png"><img class="size-medium wp-image-593" title="Choose A Download Site" alt="" src="http://ipggi.files.wordpress.com/2011/06/choose-a-download-site.png?w=300&#038;h=219" width="300" height="219" /></a><p class="wp-caption-text">Choose A Download Site.</p></div>
<p>Choose A Download Site lets you select a file repository from where Cygwin setup will download the the packages and files. It is preferable to pick a download location from a site that is physically close to your own. But if you can not determine this from the country codes in the URL or can not find a suitable mirror then simply select the first item.</p>
<h3>Selecting Packages</h3>
<div id="attachment_609" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/select-packages.png"><img class="size-medium wp-image-609" title="select packages" alt="" src="http://ipggi.files.wordpress.com/2011/06/select-packages.png?w=300&#038;h=239" width="300" height="239" /></a><p class="wp-caption-text">Select Packages.</p></div>
<p>This Select Packages screen is the most important part to Cygwin setup. It is the Cygwin package manager interface, equivalent to <a class="vt-p" href="http://www.ubuntugeek.com/synaptic-package-manager-beginners-guide-for-ubuntu-users.html">Synaptic Package Manager</a> in Debian and Ubuntu or <a class="vt-p" href="http://www.yum-extender.org">YUM Extender</a> in Fedora Linux. The screen capture has a number of arrows pointing to features of the interface but as a first time user you can completely ignore all of these and press <em>Next</em> to accept the default installation.</p>
<ul>
<li>The<span style="color:#008000;"> dark green solid arrow</span> points to the search dialogue enabling you to quickly filer packages by name. Unfortunately the search does not work on the package descriptions.</li>
<li>The <strong>solid black arrow</strong> has 4 radio buttons enabling you to mass-apply installation restrictions on all packages.</li>
<li><em>Keep</em> tells Cygwin setup not to update any installed packages.</li>
<li><em>Prev</em> is short for previous which reverts all packages back one version.</li>
<li><em>Curr</em> is the default and recommended option as it installs the current version of all selected packages.</li>
<li><em>Exp</em> will install the most current or experimental version of all selected packages.</li>
<li>The <span style="color:#c00000;">red arrows</span> point to the manager categories which can be expanded to reveal individual packages.</li>
<li>The <span style="color:#8064a2;">purple arrow</span> points to version numbers which belong to packages that are already installed onto Cygwin.</li>
<li><span style="color:#f79646;">Orange arrow</span> enables you to manually override the global package version (black arrow radio buttons).</li>
<li><em>Skip</em> means the package has not been installed and setup will ignore it.</li>
<li><em>Keep</em> means the package has been installed but setup will ignore it.</li>
<li><em>Reinstall</em> will overwrite an existing package installation with the same version from a fresh download.</li>
<li><em>1.0-1</em> or some other version number means setup will install this version of the package for the first time.</li>
<li><em>Source</em> means setup will ignore the installed package but will download the source codes.</li>
<li><em>Uninstall</em> removes the installed package from your Cygwin installation.</li>
<li>The <strong><span style="color:#fef445;">yellow arrow</span></strong> points to a Binary check-box while the <span style="color:#7fd13b;">light green</span> points to a Source check-box. These check-boxes only appear only when available to the package New column.</li>
<li>The <span style="color:#4bacb2;">light blue arrow</span> is the package download size in Kilobytes.</li>
<li><span style="color:#1f497d;">Dark blue</span> contains the package name and a brief description.</li>
</ul>
<div>
<div id="attachment_606" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/progress.png"><img class="size-medium wp-image-606" title="progress" alt="" src="http://ipggi.files.wordpress.com/2011/06/progress.png?w=300&#038;h=219" width="300" height="219" /></a><p class="wp-caption-text">Progress.</p></div>
<p>Cygwin setup will now download and install all the default-install packages. Wait until the Progress screen is complete and go onto the <em>Next</em> screen.</p>
<div id="attachment_598" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/create-icons.png"><img class="size-medium wp-image-598" title="create icons" alt="" src="http://ipggi.files.wordpress.com/2011/06/create-icons.png?w=300&#038;h=219" width="300" height="219" /></a><p class="wp-caption-text">Create Icons &amp; Install Complete.</p></div>
<p>Create Icons enable you to add Desktop and Start Menu shortcuts. Once finished use either shortcut to launch Cygwin.</p>
<h2>Bash Terminal</h2>
<div id="attachment_599" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/cygwin-home.png"><img class="size-medium wp-image-599" title="cygwin home" alt="" src="http://ipggi.files.wordpress.com/2011/06/cygwin-home.png?w=300&#038;h=151" width="300" height="151" /></a><p class="wp-caption-text">Welcome to Bash.</p></div>
<p>Welcome to your Bash prompt in Windows! You can test this by running Bash version.</p>
<pre>bash --version</pre>
<div id="attachment_592" class="wp-caption alignnone" style="width: 630px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/bash-version.png"><img class="size-full wp-image-592" title="Bash version" alt="" src="http://ipggi.files.wordpress.com/2011/06/bash-version.png?w=620&#038;h=142" width="620" height="142" /></a><p class="wp-caption-text">Display your version of Bash.</p></div>
<p>The first thing I’d recommend doing is customising your bash shell to implement some aliases for basic colouring on a few staple Cygwin commands.</p>
<pre>dir -A ~</pre>
<p>Will reveal some hidden setting files in your home directory which you can edit these using a text editor, but please avoid using the standard Windows Notepad. I use Windows <a class="vt-p" href="http://notepad-plus-plus.org/">Notepad++</a> and would edit <em>w:\cygwin\home\Ben\.bashrc </em>but you would probably need to edit<em> c:\cygwin\home\[User name]\.bashrc</em>. Windows may have issues opening a file which it sees as only having an extension but lacking a file name. If this is the case just use the <em>Open With</em> dialogue but make sure you have the <em>Always use the selected program to open this kind of file</em> check-box left unchecked.</p>
<div id="attachment_616" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/bash-settings-todo.png"><img class="size-medium wp-image-616" title="bash settings todo" alt="" src="http://ipggi.files.wordpress.com/2011/06/bash-settings-todo.png?w=300&#038;h=166" width="300" height="166" /></a><p class="wp-caption-text">The yellow highlights the settings I would recommend to un-comment.</p></div>
<div id="attachment_617" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/bash-settings-post-edit.png"><img class="size-medium wp-image-617" title="bash settings post edit" alt="" src="http://ipggi.files.wordpress.com/2011/06/bash-settings-post-edit.png?w=300&#038;h=166" width="300" height="166" /></a><p class="wp-caption-text">Bash settings file after the comments have been removed.</p></div>
<p>Once you have finished your changes you can apply them by reloading Bash.</p>
<pre>bash --login</pre>
<p>Test your new alias and option defaults.</p>
<pre>cd /
ll</pre>
<p>You now see a colourised directory and file listing of the Cygwin root.</p>
<div id="attachment_603" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/ll-of-root.png"><img class="size-medium wp-image-603" title="ll of root" alt="" src="http://ipggi.files.wordpress.com/2011/06/ll-of-root.png?w=300&#038;h=120" width="300" height="120" /></a><p class="wp-caption-text">Line list of root.</p></div>
<p>This is the same directory as you chose during the Cygwin setup installation which by default is <em>c:\cygwin</em>. You can use either Windows File Explorer, Windows command prompt or Cygwin to modify the contents of the root. For more details on how Cygwin handles POSIX permissions within Windows and other potential incompatibilities I&#8217;d recommend reading the <a class="vt-p" href="http://cygwin.com/cygwin-ug-net/ntsec.html">Using Windows Security</a> in Cygwin chapter in the manual.</p>
<h3>Tips</h3>
<p>By default there is no Cygwin clear command (<em>cls</em> in command prompt) but the easiest way to clean your terminal is to press <strong>[Ctrl]  l</strong>.</p>
<p>Use the <strong>[Tab]</strong> key on your keyboard to auto-complete commands, file and directory names. This Bash feature is superior to the basic Tab auto-complete used by Windows command prompt.</p>
<p>Did you also know you can chain 2 or more commands together using a semi-column <strong>;</strong> character as the separator.</p>
<pre>cd /; echo "Root Directory"; ls; cd ~; echo "My Home Directory"; ls</pre>
<p>And if you didn&#8217;t realise in the command above, change directory forward-slash <em>cd /</em> takes you to the Cygwin root, while change directory tilde <em>cd ~</em> takes you to your user home directory.</p>
<h2>Drill Down of the Cygwin Root</h2>
<ul id="internal-source-marker_0.14371047518216074">
<li><strong>Cygwin.bat</strong> is the Windows batch file used to launch a Cygwin Bash prompt within a Windows command prompt.</li>
<li><strong>Cygwin.ico</strong> is a standard Windows icon file attached to the Cygwin batch file.</li>
<li><strong>bin/</strong> is a directory containing binary (execute) applications that have been compiled for use on Windows under Cygwin. In here are all the unique POSIX-like commands and applications that give you all that extra functionality that a bare-Windows install often lacks.</li>
<li><strong>cygdrive/</strong> contains a list of mounted Windows drive letters. From here you can access any drive partition that is viewable to Windows. For example <em>cygdrive/c/Windows/</em> would be the location of most peoples Windows installation.</li>
<li><strong>dev/</strong> is short for devices. Traditionally for POSIX this is where your detected hardware devices are listed but in Cygwin its usage is mainly there for software compatibility and can be ignored. <a class="vt-p" href="http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-posixdevices">http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-posixdevices</a></li>
<li><strong>etc/</strong> contains all your Cygwin related configuration files. Unlike the Windows registry these should all be plain text files that can be edited within any Windows text editor (such as NotePad++) or a Cygwin editor such as VM or Nano.</li>
<li><strong>home/</strong> contains the user directories which are not unlike the Windows User directories. This is where your non-Cygwin files such as documents, file downloads should be stored.</li>
<li><strong>lib/</strong> is an abbreviation of library. These are compiled, shared components that are used by various Cygwin commands and applications but you can ignore this directory.</li>
<li><strong>proc/</strong> is a virtual directory that allows you to display various aspects of your system using the <em>cat</em> command.</li>
<li><em>cat /proc/cpuinfo</em> Displays your computer CPU details.</li>
<li><em>cat /proc/meminfo</em> Displays your Windows memory information.</li>
<li><em>cat /proc/mounts</em> Lists your disk mounts within Cygwin.</li>
<li><strong>tmp/</strong> is the Cygwin temporary directory.</li>
<li><strong>usr/</strong> is the bread and butter of your Cygwin install.</li>
<li><strong>usr/bin/</strong> is identical to <em>bin/</em> that was listed previously.</li>
<li><strong>usr/include/</strong> are programming header files which are somewhat like shared libraries, you can ignore this.</li>
<li><strong>usr/local/</strong> is a location where you can compile applications for yourself, again if this does not interest you it can be ignored.</li>
<li><strong>usr/sbin/</strong> contains system binaries and applications tools for Cygwin system administration.</li>
<li><strong>usr/share/</strong> are platform independent read-only shared files such as documentation. For example <em>/usr/share/fonts</em> contain a collection of system fonts. <em>/usr/share/doc</em> contains application documents.</li>
<li><strong>usr/src/</strong> is a location for storing application source code.</li>
<li><strong>usr/ssl/</strong> is a location for storing SSL (Secure Socket Layer) and TLS (Transport Layer Security) certificates which are used for Internet communication encryption and security.</li>
<li><strong>usr/tmp/</strong> is the same temporary folder as <em>/tmp</em>.</li>
<li><strong>var/</strong> is where variable data files are stored. These are files generated by yourself or applications. For example all log files would go in <em>/var/log</em>. If you ran an Apache HTTP daemon the files it hosted would be contained in <em>/var/www</em>.</li>
</ul>
<h2>POSIX and Cygwin Commands</h2>
<p>Now the usage of a Bash shell or POSIX-like commands is out of the scope of this article. You can run <em>dir /bin</em> to see all the <em>.exe</em> execute commands available to you within Cygwin. Like Windows command prompt you do not need to include the file extension when running an application, <em>dir </em>works the same as <em>dir.exe</em>.</p>
<p>If you need quick help on the usage of a command, use <em>[command] &#8211;help</em> e.g. <em>dir &#8211;help</em>. Many commands share the same options.</p>
<p>If you think the default Cygwin bash shell is a bit ugly then you are not alone. Microsoft does not give the default command prompt much love and unfortunately this is what Cygwin relies on for its own terminal interface. You can easily change this though by again running Cygwin <em>setup.exe</em>. When you are back in the Select Packages screen do a search for <strong>mintty</strong>. Select to install the mintty binary package and once complete go to your Cygwin start menu. There should be a new mintty option in addition to the Cygwin Bash Shell.</p>
<div>
<div id="attachment_605" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/mintty-install.png"><img class="size-medium wp-image-605" title="Mintty install" alt="" src="http://ipggi.files.wordpress.com/2011/06/mintty-install.png?w=300&#038;h=143" width="300" height="143" /></a><p class="wp-caption-text">Install Mintty Terminal.</p></div>
<div id="attachment_596" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/cli-compare-cygwin.png"><img class="size-medium wp-image-596" title="cli compare cygwin" alt="" src="http://ipggi.files.wordpress.com/2011/06/cli-compare-cygwin.png?w=300&#038;h=151" width="300" height="151" /></a><p class="wp-caption-text">Cygwin under command prompt is not that attractive.</p></div>
<div id="attachment_597" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/cli-compare-mintty.png"><img class="size-medium wp-image-597" title="cli compare mintty" alt="" src="http://ipggi.files.wordpress.com/2011/06/cli-compare-mintty.png?w=300&#038;h=165" width="300" height="165" /></a><p class="wp-caption-text">Cygwin under Mintty allows for font smoothing.</p></div>
</div>
<div>From now on use Mintty for a cleaner terminal interface to Cygwin.</div>
<h2>Services and Daemons</h2>
<p>Want to to implement a service or daemon into your Cygwin install? I will show an basic example using Lighttpd, a light-weight HTTP server that is an alternative to Apache2 HTTP (which also can be installed to Cygwin).</p>
<p>Run Cygwin <em>setup.exe</em> again to search and install <strong>lighttpd </strong>and make sure you say yes to install any resolving dependencies. Once installed you will find the application residing in the <em>usr/sbin/</em> directory as <em>lighttpd.exe</em>. An example configuration file <em>lighttpd.conf.default</em> can be found in <em>etc/lighttpd/</em>. We will create an empty configuration file using the touch command.</p>
<pre>cd /etc/lighttpd
touch lighttpd.conf</pre>
<p>Now use your Windows notepad application to edit <em>c:/cygwin/etc/lighttpd/lighttpd.conf</em> and copy the settings listed below.</p>
<blockquote>
<p dir="ltr" id="internal-source-marker_0.14371047518216074">server.document-root = &#8220;/var/www/servers/www.example.org/pages/&#8221;</p>
<p>server.port = 80</p>
<p>server.username = &#8220;www&#8221;<br />
server.groupname = &#8220;www&#8221;</p>
<p>mimetype.assign = (<br />
&#8220;.html&#8221; =&gt; &#8220;text/html&#8221;,<br />
&#8220;.txt&#8221; =&gt; &#8220;text/plain&#8221;,<br />
&#8220;.jpg&#8221; =&gt; &#8220;image/jpeg&#8221;,<br />
&#8220;.png&#8221; =&gt; &#8220;image/png&#8221;<br />
)</p>
<p>static-file.exclude-extensions = ( &#8220;.fcgi&#8221;, &#8220;.php&#8221;, &#8220;.rb&#8221;, &#8220;~&#8221;, &#8220;.inc&#8221; )<br />
index-file.names = ( &#8220;index.html&#8221; )</p>
<p>$HTTP["host"] == &#8220;www2.example.org&#8221; {<br />
server.document-root = &#8220;/var/www/servers/www2.example.org/pages/&#8221;<br />
}</p></blockquote>
<p>This config we are using is taken from the <a class="vt-p" href="http://redmine.lighttpd.net/wiki/lighttpd/TutorialConfiguration">Lighttpd Configuration Tutorial</a>.</p>
<p>Now attempt to launch lighttpd with your new configuration file.</p>
<pre>/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf</pre>
<p>Our attempt will fail because the web server document root directory does not exist, so let&#8217;s create that and lets also make an <em>index.html</em> document and try it again.</p>
<pre>mkdir /var/www ; mkdir /var/www/servers ; mkdir /var/www/servers/www.example.org ; mkdir /var/www/servers/www.example.org/pages
touch /var/www/servers/www.example.org/pages/index.html</pre>
<p dir="ltr" id="internal-source-marker_0.14371047518216074">In a Windows notepad application edit <em>c:/cgywin/var/www/servers/www.example.org/pages/index.html</em> and copy/paste the following HTML code.</p>
<blockquote>
<p dir="ltr" id="internal-source-marker_0.14371047518216074">&lt;html&gt;<br />
&lt;title&gt;Hello World&lt;/title&gt;<br />
&lt;body&gt;<br />
&lt;h1&gt;Hello from Lighttpd running in Cygwin!&lt;h1&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
</blockquote>
<div id="attachment_620" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/index-html-file.png"><img class="size-medium wp-image-620" title="index html file" alt="" src="http://ipggi.files.wordpress.com/2011/06/index-html-file.png?w=300&#038;h=84" width="300" height="84" /></a><p class="wp-caption-text">index.html content.</p></div>
<p>Let&#8217;s retry running Lighttpd again.</p>
<pre>/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf</pre>
<p>Once Lighttpd has loaded you may need to press the <strong>Enter</strong> key to restore your Bash prompt but Lighttpd will continue to run in the background. Now point your local Windows web browser to <em>127.0.0.1</em> or <em>localhost</em>.</p>
<div id="attachment_595" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/chrome-browser-viewing-lighttpd.png"><img class="size-medium wp-image-595" title="chrome browser viewing lighttpd" alt="" src="http://ipggi.files.wordpress.com/2011/06/chrome-browser-viewing-lighttpd.png?w=300&#038;h=128" width="300" height="128" /></a><p class="wp-caption-text">Chrome browser viewing our primitive HTML file.</p></div>
<p>When you want to shutdown Lighttpd run find the PID (<strong>P</strong>rocess <strong>Id</strong>entifier) and kill it.</p>
<pre>ps -s
kill [PID number]</pre>
<div id="attachment_607" class="wp-caption alignnone" style="width: 310px"><a class="vt-p" href="http://ipggi.files.wordpress.com/2011/06/ps-and-kill.png"><img class="size-medium wp-image-607" title="ps and kill" alt="" src="http://ipggi.files.wordpress.com/2011/06/ps-and-kill.png?w=300&#038;h=154" width="300" height="154" /></a><p class="wp-caption-text">Discover and shutdown of the Lighttpd service.</p></div>
<p>Congratulations! You have successfully implemented a Bash shell environment on your Windows operating system that also has a robust but simple <a class="vt-p" href="http://www.lighttpd.net/">HTTP server</a>.</p>
<h2>Popular Cygwin Applications</h2>
<p>Other popular Cygwin packages that maybe of interest.</p>
<p>Servers services such as <a class="vt-p" href="http://httpd.apache.org/">Apache</a>, <a class="vt-p" href="http://www.isc.org/software/bind">BIND</a>, <a class="vt-p" href="www.postgresql.org">PostgreSQL</a>, <a class="vt-p" href="www.pureftpd.org/">Pure-FTPd</a>, <a class="vt-p" href="http://www.openssh.com/">OpenSSH</a>.<br />
Programming languages such as C, C++, <a class="vt-p" href="http://www.perl.org/">Perl</a>, <a class="vt-p" href="http://www.python.org/">Python</a>, <a class="vt-p" href="http://www.ruby-lang.org">Ruby</a>, <a class="vt-p" href="http://www.tcl.tk/">TCL</a>.<br />
Remote log-in tools SSH, RSH, Telnet.<br />
File transfer tools FTP, SCP, rsync, unison, rtorrent.<br />
In addition to an extensive range of network, system and file diagnostics tools.</p>
<p>More information on Cygwin can be found in its <a class="vt-p" href="http://www.cygwin.com/cygwin-ug-net/cygwin-ug-net.html">User&#8217;s Guide</a>.</p>
</div>
<br />Filed under: <a href='http://ipggi.wordpress.com/category/linux/cygwin/'>cygwin</a>, <a href='http://ipggi.wordpress.com/category/linux/'>Linux</a>, <a href='http://ipggi.wordpress.com/category/server-2/'>Server</a>, <a href='http://ipggi.wordpress.com/category/windows/'>Windows</a> Tagged: <a href='http://ipggi.wordpress.com/tag/bash/'>bash</a>, <a href='http://ipggi.wordpress.com/tag/cygwin/'>cygwin</a>, <a href='http://ipggi.wordpress.com/tag/lighttpd/'>lighttpd</a>, <a href='http://ipggi.wordpress.com/tag/linux/'>Linux</a>, <a href='http://ipggi.wordpress.com/tag/posix/'>posix</a>, <a href='http://ipggi.wordpress.com/tag/powershell/'>powershell</a>, <a href='http://ipggi.wordpress.com/tag/unix/'>unix</a>, <a href='http://ipggi.wordpress.com/tag/windows/'>Windows</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ipggi.wordpress.com/590/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ipggi.wordpress.com/590/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ipggi.wordpress.com&#038;blog=2513273&#038;post=590&#038;subd=ipggi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ipggi.wordpress.com/2011/07/01/cygwin-walkthrough-and-beginners-guide-is-it-linux-for-windows-or-a-posix-compatible-alternative-to-powershell/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<georss:point>51.524531 -0.008318</georss:point>
		<geo:lat>51.524531</geo:lat>
		<geo:long>-0.008318</geo:long>
		<media:content url="http://0.gravatar.com/avatar/01aa96818e11d6d361d9832c957f8a0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Ipggi</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/cygwin-net-release-setup-program.png?w=300" medium="image">
			<media:title type="html">cygwin net release setup program</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/choose-a-download-source.png?w=300" medium="image">
			<media:title type="html">choose a download source</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/select-root-install-directory.png?w=300" medium="image">
			<media:title type="html">Select Root Install Directory</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/select-local-package-directory.png?w=300" medium="image">
			<media:title type="html">select local package directory</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/select-your-internet-connection.png?w=300" medium="image">
			<media:title type="html">select your internet connection</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/choose-a-download-site.png?w=300" medium="image">
			<media:title type="html">Choose A Download Site</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/select-packages.png?w=300" medium="image">
			<media:title type="html">select packages</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/progress.png?w=300" medium="image">
			<media:title type="html">progress</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/create-icons.png?w=300" medium="image">
			<media:title type="html">create icons</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/cygwin-home.png?w=300" medium="image">
			<media:title type="html">cygwin home</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/bash-version.png" medium="image">
			<media:title type="html">Bash version</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/bash-settings-todo.png?w=300" medium="image">
			<media:title type="html">bash settings todo</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/bash-settings-post-edit.png?w=300" medium="image">
			<media:title type="html">bash settings post edit</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/ll-of-root.png?w=300" medium="image">
			<media:title type="html">ll of root</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/mintty-install.png?w=300" medium="image">
			<media:title type="html">Mintty install</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/cli-compare-cygwin.png?w=300" medium="image">
			<media:title type="html">cli compare cygwin</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/cli-compare-mintty.png?w=300" medium="image">
			<media:title type="html">cli compare mintty</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/index-html-file.png?w=300" medium="image">
			<media:title type="html">index html file</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/chrome-browser-viewing-lighttpd.png?w=300" medium="image">
			<media:title type="html">chrome browser viewing lighttpd</media:title>
		</media:content>

		<media:content url="http://ipggi.files.wordpress.com/2011/06/ps-and-kill.png?w=300" medium="image">
			<media:title type="html">ps and kill</media:title>
		</media:content>
	</item>
	</channel>
</rss>
