<?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:go='http://ns.gigaom.com/'
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>GigaOM &#187; Apple</title>
	<atom:link href="http://gigaom.com/apple/tag/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://gigaom.com</link>
	<description></description>
	<lastBuildDate>Fri, 10 Feb 2012 09:11:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='gigaom.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/0db8f6557d022075dbbf010c54d46d93?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>GigaOM &#187; Apple</title>
		<link>http://gigaom.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://gigaom.com/osd.xml" title="GigaOM" />
	<atom:link rel='hub' href='http://gigaom.com/?pushpress=hub'/>
		<item>
		<title>Dig Into Unix: Sed and Awk</title>
		<link>http://gigaom.com/apple/dig-into-unix-sed-and-awk/</link>
		<comments>http://gigaom.com/apple/dig-into-unix-sed-and-awk/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 20:37:46 +0000</pubDate>
		<dc:creator>Jon Buys</dc:creator>
				<category><![CDATA[Walkthroughs]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[dig into unix]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://theappleblog.com/?p=29831</guid>
		<description><![CDATA[Time again to pop a shell and dig into the deep, geeky Unix internals of OS X with Dig Into Unix. Today we are going to look at two top-shelf power tools for text editing: sed and awk. Sed is a Stream EDitor, and if you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gigaom.com&amp;blog=14960843&amp;post=173173&amp;subd=gigaom2&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img  title="Terminal" src="http://gigapple.files.wordpress.com/2009/05/terminal.png?w=133&#038;h=118" alt="Terminal" width="133" height="118" class=" alignleft" /></p>
<p class="excerpt">Time again to pop a shell and dig into the deep, geeky Unix internals of OS X with <a href="http://theappleblog.com/tag/dig-into-unix/">Dig Into Unix</a>. Today we are going to look at two top-shelf power tools for text editing: <a href="http://developer.apple.com/documentation/Darwin/Reference/Manpages/man1/sed.1.html">sed</a> and <a href="http://developer.apple.com/documentation/Darwin/Reference/Manpages/man1/awk.1.html">awk</a>.</p>
<p>Sed is a Stream EDitor, and if you recall our <a href="http://gigaom.com/apple/dig-into-unix-standard-streams/">previous</a> Dig Into Unix installment concerning standard streams, you&#8217;ll understand that the streams we are talking about are actually just text from one source or another. Sed&#8217;s bread and butter is text search and replace, very similary to the &#8220;Edit&#8221; and &#8220;Find&#8230;&#8221; functions in TextEdit and many other GUI text editors. Unlike those text editors though, sed, by default, will write its output to the screen, or stdout. <span id="more-173173"></span></p>
<p>As an example, try some basic operations on this string of text:<br />
<code>The quick brown fox jumped over the lazy dog's back.</code></p>
<p>Save the string of text as a file named test.txt, and type this into the Terminal:<br />
<code>sed s/quick/slow/g test.txt</code></p>
<p>The fox is now slow on the screen, but not changed in the file itself. To follow the stream, the text came from the file, through sed, and to the screeen. The best set of examples I&#8217;ve found for getting right into sed and starting to play with it is the collection of <a href="http://sed.sourceforge.net/sed1line.txt">sed one liners</a> hosted at Sourceforge.</p>
<p>Personally, I use sed when I&#8217;ve got a large number of configuration files that need to be edited. For example, it might be decided that we do not need our <a href="http://www.nagios.org/">Nagios</a> monitoring system alerting on the a certain statistic. I could go into 100 different files and perform the same action on all of them, or I could rely on a simple shell script and sed to do it for me.</p>
<p><code><br />
for each in `ls *.cfg`; do<br />
mv $each $each.bak #Safety First!<br />
sed '30,35s/^/#/g' $each.bak &gt; $each<br />
done<br />
</code></p>
<p>This will plow through all of the config files in a certain directory and add a # sign at the beginning of lines 30 through 35, commenting those lines out. Then I can restart Nagios, and if all goes well, delete all of the .bak files created as backups by the script.</p>
<p>While sed operates on lines and regular expressions (the subject of a future Dig Into Unix article!), awk works with <em>fields</em>. When given a stream of text, either from a text file or piped in from another application, awk can manipulate the text and rearrange the words. By default, awk separates the text fields by a space character, but you can use any other character you&#8217;d like.</p>
<p>Like sed, awk also has a great collection of <a href="http://www.pement.org/awk/awk1line.txt">one liners</a>, this collection here is a great resource collected by Eric Pement. In my day to day activities, I call on awk when I want to format text for a report or to be input into another application.</p>
<p>To use our quick brown fox example again, we can print only the fourth, third, and second words, in reverse order, with this command:<br />
<code>awk '{ print $4, $3, $2 }' test</code></p>
<p>That will print out &#8220;fox brown quick&#8221;. Not very practical or useful. Something more practical might be to manipulate a list of comma separated values. Using the &#8220;-F&#8221; flag in awk, you can tell awk to separate it&#8217;s fields based on the comma, as in:<br />
<code>awk -F, '{ print $1 }' test</code></p>
<p>Since there are no commas in the test file, this will print the entire string of text. So, we could run this command to take care of that:<br />
<code>sed s/ /,/g test &gt; test2</code></p>
<p>This will use sed to replace all spaces with commas. The backslash is there to escape a special character, so the space is interpreted literally and not as part of a command. Now, you could use awk to manipulate the string of text as needed.<br />
<code>awk -F, '{ print $7, $8, $9, $10, $5, $6, $1, $2, $3, $4 " did" }' test2</code></p>
<p>This article has just barely skimmed the surface of what sed and awk can do. There are some rather hefty books dedicated to the pair, <a title="sed &amp; awk | O'Reilly Media" href="http://oreilly.com/catalog/9781565922259/">this one</a> from O&#8217;Reilly has been on my desk for years now. Awk is an entire programming language, but the point of this series is not to teach the in-depth details, it&#8217;s just to get your feet wet, and maybe, just maybe leave you thirsting for more. The real rub is that everything that sed and awk can do can also be done, at times more efficiently, with the practical extraction and report language&#8230;better known as Perl, which is the subject of a future Dig Into Unix article.</p>
<p><strong>Related research and analysis from GigaOM Pro:</strong><br />Subscriber content. <a href="http://pro.gigaom.com/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=173173+dig-into-unix-sed-and-awk&utm_content=oszen">Sign up for a free trial</a>.</p><ul><li><a href="http://pro.gigaom.com/2011/03/why-ipad-2-will-lead-consumers-into-the-post-pc-era/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=173173+dig-into-unix-sed-and-awk&utm_content=oszen">Why iPad 2 Will Lead Consumers Into the Post-PC&nbsp;Era</a></li><li><a href="http://pro.gigaom.com/2011/03/the-near-term-evolution-of-social-commerce/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=173173+dig-into-unix-sed-and-awk&utm_content=oszen">The Near-Term Evolution of Social&nbsp;Commerce</a></li><li><a href="http://pro.gigaom.com/2011/02/content-farms-the-players-the-benefits-the-risks/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=173173+dig-into-unix-sed-and-awk&utm_content=oszen">Content Farms: The Players, The Benefits, The&nbsp;Risks</a></li></ul><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gigaom.com&amp;blog=14960843&amp;post=173173&amp;subd=gigaom2&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gigaom.com/apple/dig-into-unix-sed-and-awk/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7d5b8247e2eb580f5443ade7bbf2a067?s=96&#38;d=retro&#38;r=PG" medium="image">
			<media:title type="html">jBuys</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2009/05/terminal.png" medium="image">
			<media:title type="html">Terminal</media:title>
		</media:content>
	</item>
		<item>
		<title>Tips &amp; Tricks: What’s Your Alias?</title>
		<link>http://gigaom.com/apple/tips-tricks-whats-your-alias/</link>
		<comments>http://gigaom.com/apple/tips-tricks-whats-your-alias/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 21:00:22 +0000</pubDate>
		<dc:creator>Christopher Ryan</dc:creator>
				<category><![CDATA[SYN Feature Enterprise]]></category>
		<category><![CDATA[alias]]></category>
		<category><![CDATA[arrow]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[shortcut]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://theappleblog.com/?p=28268</guid>
		<description><![CDATA[Aliases in Mac OS X are essentially equivalent to shortcuts in the Windows world. They work by creating a link to an original file located somewhere on your Mac or network and maintain the link even if the original is moved or renamed. How to Create [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gigaom.com&amp;blog=14960843&amp;post=173058&amp;subd=gigaom2&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img  title="Front Row Alias Icon Example" src="http://gigapple.files.wordpress.com/2009/07/frontrowaliasiconexample.jpg?w=353&#038;h=197" alt="Front Row Alias Icon Example" width="353" height="197" class=" alignleft" /></p>
<p class="excerpt">Aliases in Mac OS X are essentially equivalent to shortcuts in the Windows world. They work by creating a link to an original file located somewhere on your Mac or network and maintain the link even if the original is moved or renamed.</p>
<h3>How to Create Aliases</h3>
<p>Creating aliases is pretty easy. You can right-click on a file and select “Make Alias” or choose “Make Alias” from the File menu. Viola! You have created an alias, indicated by the shortcut arrow on the icon and the word “alias” appended to the end of the file name.</p>
<p>If you want to create an alias and not have it include “alias” at the end, you can do so by holding down the command and option keys while dragging the desired file to a new location other than the original. <span id="more-173058"></span></p>
<h3>How to Ditch the Arrow</h3>
<p>You can easily tell your aliases apart from your original files by the fact that aliases include a little arrow in their icon. For some, this may be a great reminder, but for others who may be creating collections of aliases for custom stacks in the Dock, or other reasons, the arrows may be annoying. Fortunately, with a little trip to the Terminal, we can solve this dilemma.</p>
<p>Essentially what we are going to do is take the graphic files that apply the arrow “badge” onto the icons and rename them so Mac OS X cannot find them. If your system cannot find the arrows, it cannot apply them to your aliases. <strong>This modification will affect all aliases on your Mac.</strong></p>
<p>The first step is to fire up Terminal (located in the Utilities folder inside your Applications folder). At the command prompt, copy and paste the following line of code.</p>
<p><code>cd /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources</code></p>
<p>This navigates to the location where the alias badge icons are stored. Then copy and paste this next line of code. It will require your administrator password after you execute the command.</p>
<p><code>sudo mv AliasBadgeIcon.icns AliasBadgeIcon_OFF.icns</code></p>
<p>For Terminal newbies, this command invokes “sudo,” which allows you to run powerful commands as another user, in this case, the “root” user. The “mv” command is Unix-talk for “move files.” In the example above, it simply causes the file to be renamed.</p>
<p>To see the changes, you can either restart your computer, or type in the following line of code. (In my tests using the latest builds of Snow Leopard, I actually had to restart the system to see the results).</p>
<p><code>killall Finder</code></p>
<p>To put them back, simply follow the steps again, but when you reach the sudo command, use this line of code.</p>
<p><code>sudo mv AliasBadgeIcon_OFF.icns AliasBadgeIcon.icns</code></p>
<p><strong>Related research and analysis from GigaOM Pro:</strong><br />Subscriber content. <a href="http://pro.gigaom.com/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=173058+tips-tricks-whats-your-alias&utm_content=limeology">Sign up for a free trial</a>.</p><ul><li><a href="http://pro.gigaom.com/2011/03/why-ipad-2-will-lead-consumers-into-the-post-pc-era/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=173058+tips-tricks-whats-your-alias&utm_content=limeology">Why iPad 2 Will Lead Consumers Into the Post-PC&nbsp;Era</a></li><li><a href="http://pro.gigaom.com/2011/03/the-near-term-evolution-of-social-commerce/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=173058+tips-tricks-whats-your-alias&utm_content=limeology">The Near-Term Evolution of Social&nbsp;Commerce</a></li><li><a href="http://pro.gigaom.com/2011/02/content-farms-the-players-the-benefits-the-risks/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=173058+tips-tricks-whats-your-alias&utm_content=limeology">Content Farms: The Players, The Benefits, The&nbsp;Risks</a></li></ul><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gigaom.com&amp;blog=14960843&amp;post=173058&amp;subd=gigaom2&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gigaom.com/apple/tips-tricks-whats-your-alias/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/832459ff6ff50bbfb3a2b901927c1448?s=96&#38;d=retro&#38;r=PG" medium="image">
			<media:title type="html">limeology</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2009/07/frontrowaliasiconexample.jpg" medium="image">
			<media:title type="html">Front Row Alias Icon Example</media:title>
		</media:content>
	</item>
		<item>
		<title>Dig Into Unix: Standard Streams</title>
		<link>http://gigaom.com/apple/dig-into-unix-standard-streams/</link>
		<comments>http://gigaom.com/apple/dig-into-unix-standard-streams/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 22:00:54 +0000</pubDate>
		<dc:creator>Jon Buys</dc:creator>
				<category><![CDATA[SYN Feature Enterprise]]></category>
		<category><![CDATA[Walkthroughs]]></category>
		<category><![CDATA[dig into unix]]></category>
		<category><![CDATA[pipe]]></category>
		<category><![CDATA[stderr]]></category>
		<category><![CDATA[stdin]]></category>
		<category><![CDATA[stdout]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://theappleblog.com/?p=27216</guid>
		<description><![CDATA[This is the third installment of our Dig Into Unix series, an ongoing look into the deep, geeky insides of the core of OS X. In the first part, we got to fire up the Terminal and take a look around the filesystem as the OS [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gigaom.com&amp;blog=14960843&amp;post=172999&amp;subd=gigaom2&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img  title="terminal_icon" src="http://gigapple.files.wordpress.com/2009/06/terminal_icon.png?w=150&#038;h=150" alt="terminal_icon" width="150" height="150" class=" alignleft" /></p>
<p class="excerpt">This is the third installment of our <a title="dig into unix" href="http://theappleblog.com/tag/dig-into-unix/">Dig Into Unix series</a>, an ongoing look into the deep, geeky insides of the core of OS X. In the <a href="http://gigaom.com/apple/dig-into-unix/">first part</a>, we got to fire up the Terminal and take a look around the filesystem as the OS sees it, which is slightly different from how the rest of us see it through the Finder. In the <a href="http://gigaom.com/apple/dig-into-unix-vi/">second installment</a>, we took a look at vi, the ancient text editor fit for kings.</p>
<p>Today, I’d like to cover a very basic, but very powerful, aspect of Unix, the three standard streams: standard in, standard out, and standard error. These three are normally abbreviated as stdin, stdout and stderr. <span id="more-172999"></span></p>
<p><img  title="dig_unix_single_stream" src="http://gigapple.files.wordpress.com/2009/06/dig_unix_single_stream.png?w=161&#038;h=160" alt="dig_unix_single_stream" width="161" height="160" class=" alignleft" /> When interacting with an application on the command line, it’s good to imagine that application with three pipes. One is a big funnel, right on top &#8212; this is stdin, accepting input from the keyboard. The second pipe is on the bottom, stdout, sending text to the Terminal. The third, stderr, sticks out the side, and normally also sends its output to the Terminal. I say &#8220;normally&#8221; because the standard streams can be redirected by certain key characters. For example, if you use “cat” to display a document, you are sending stdout to the Terminal. However, if you use “cat” like this, you actually send the output of the cat command to another file, redirecting stdout to a new text file.</p>
<p><code>cat someFile 1&gt; someCopy.txt</code></p>
<p>The number one in the command above represents stdout. The right arrow is telling the shell that you’d like to redirect stdout to a new file. If that file already exists, this command will replace that file with the contents of “someFile”. If you’d like to append the text to someCopy.txt, you could do this as well:</p>
<p><code>cat someOtherFile 1&gt;&gt; someCopy.txt</code></p>
<p>You’ll notice that I used two right arrows that time. Using the double right arrows tells the shell to append the text to the end of the file. This works great for keeping a running log of regularly scheduled tasks.</p>
<p>Sometimes you’ll want to either keep error messages out of the way, or you’ll like to keep a log of error messages. In this case, you can redirect stderr to a file like this:</p>
<p><code>grep something somewhere 2&gt; grep_error_log</code></p>
<p>The grep command is another Unix power tool that we’ll touch on later in the series. For now, just know that grep searches for strings of text in files. In the command above, I told grep to search for the string “something” in the file “somewhere” and then redirect stderr “2” to a file named “grep_error_log.” Run this command without the redirect on it, then add the redirect and run it again. You can compare the contents of the error log to what you saw on the terminal and see that they are the same.</p>
<p>Being able to redirect output is handy, but not really a “power tool.” The real power is in the pipe, the key on the far right above the return key, that looks like this: &#8220;|&#8221;, and it’s probably a key that you may have looked at and wondered…“why is that there?” The pipe takes the stdout from one command and feeds it to the stdin of another command. Think about the picture above; now imagine plugging lots of different commands into each other in a long string. The nature of Unix is that it is continually used in ways that its creators never imagined. It is truly a system limited only by your creativity and curiosity.</p>
<p style="text-align: center;"><img  title="dig_unix_multiple_streams" src="http://gigapple.files.wordpress.com/2009/06/dig_unix_multiple_streams.png?w=604" alt="dig_unix_multiple_streams" class=" alignleft" /></p>
<p>During one of my early classes on Unix, after we had entered in a command very similar to the one below, the instructor stood up and said, &#8220;Congratulations, you are all programmers!&#8221; We weren&#8217;t, not by a long shot, but the idea was that by entering commands and stringing them together in the Terminal, we were programming the computer to perform a specific task. We were not using a traditional &#8220;programming&#8221; language like C or even Java, but we were <em>programming</em> directly to the shell.</p>
<p>To put this idea into action, consider this command:</p>
<p><code>cat someFile | grep someText 1&gt; foundText</code></p>
<p>First of all, yes, I’m aware that this is a <a href="http://en.wikipedia.org/wiki/Cat_(Unix)#Useless_use_of_cat">useless use of cat</a>. That’s not the point. The point is that the above command connects cat&#8217;s stdout, which normally points to the Terminal, to stdin of grep, which then searches what it has been handed for the string “someText,” and then, just for good measure, redirect the output of grep to a file named “foundText.”</p>
<p>The simple illustrations I’ve given here work in all kinds of situations. Personally, I use the pipe and stream redirection to parse the results of commands that search logs, retrieve information from the Internet, and reformat data into comma separated values for importing into Numbers, Excel or OpenOffice. There are very few limitations to what you can do with plain text and the tools lurking under the hood of your Mac.</p>
<p><strong>Related research and analysis from GigaOM Pro:</strong><br />Subscriber content. <a href="http://pro.gigaom.com/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=172999+dig-into-unix-standard-streams&utm_content=oszen">Sign up for a free trial</a>.</p><ul><li><a href="http://pro.gigaom.com/2011/03/why-ipad-2-will-lead-consumers-into-the-post-pc-era/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=172999+dig-into-unix-standard-streams&utm_content=oszen">Why iPad 2 Will Lead Consumers Into the Post-PC&nbsp;Era</a></li><li><a href="http://pro.gigaom.com/2011/03/the-near-term-evolution-of-social-commerce/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=172999+dig-into-unix-standard-streams&utm_content=oszen">The Near-Term Evolution of Social&nbsp;Commerce</a></li><li><a href="http://pro.gigaom.com/2011/02/content-farms-the-players-the-benefits-the-risks/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=172999+dig-into-unix-standard-streams&utm_content=oszen">Content Farms: The Players, The Benefits, The&nbsp;Risks</a></li></ul><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gigaom.com&amp;blog=14960843&amp;post=172999&amp;subd=gigaom2&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gigaom.com/apple/dig-into-unix-standard-streams/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7d5b8247e2eb580f5443ade7bbf2a067?s=96&#38;d=retro&#38;r=PG" medium="image">
			<media:title type="html">jBuys</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2009/06/terminal_icon.png" medium="image">
			<media:title type="html">terminal_icon</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2009/06/dig_unix_single_stream.png" medium="image">
			<media:title type="html">dig_unix_single_stream</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2009/06/dig_unix_multiple_streams.png" medium="image">
			<media:title type="html">dig_unix_multiple_streams</media:title>
		</media:content>
	</item>
		<item>
		<title>Dig Into Unix: vi</title>
		<link>http://gigaom.com/apple/dig-into-unix-vi/</link>
		<comments>http://gigaom.com/apple/dig-into-unix-vi/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 19:00:01 +0000</pubDate>
		<dc:creator>Jon Buys</dc:creator>
				<category><![CDATA[SYN Feature Enterprise]]></category>
		<category><![CDATA[dig into unix]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[terminal.app]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://theappleblog.com/?p=25092</guid>
		<description><![CDATA[Continuing our Dig Into Unix series, we&#8217;ve now covered the absolute basics of launching Terminal.app, moving around the file system, looking at files with cat, and learning about commands with man. Now, I&#8217;d like to introduce you to the power of vi. vi (pronounced vee-eye) is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gigaom.com&amp;blog=14960843&amp;post=172837&amp;subd=gigaom2&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img  title="terminal_icon" src="http://gigapple.files.wordpress.com/2009/06/terminal_icon.png?w=150&#038;h=150" alt="terminal_icon" width="150" height="150" class=" alignleft" /></p>
<p class="excerpt">Continuing our <a href="http://theappleblog.com/tag/dig-into-unix">Dig Into Unix</a> series, we&#8217;ve now covered the absolute basics of launching Terminal.app, moving around the file system, looking at files with <strong>cat</strong>, and learning about commands with <strong>man</strong>. Now, I&#8217;d like to introduce you to the power of <strong>vi</strong>.</p>
<p>vi (pronounced vee-eye) is a text editor for the command line, and was originally written by Bill Joy in 1976. vi is now part of every single Unix system, including OS X. The version included with Leopard is <a href="http://www.vim.org/">vim</a>, which stands for Vi iMproved. One of the major problems that vi has faced over the years is that it has a major learning curve. Every action that you take in vi you do with keyboard combos. Since there are so many actions that you can do, it takes awhile to get used to the different keystrokes, but once you do, they become ingrained in your fingers. From time to time, when typing in some other app, I find myself hitting the escape key followed by <code>jjj</code> or <code>hhh</code> trying to move the curser. <span id="more-172837"></span></p>
<h3>Getting Started</h3>
<p>To get started, open up Terminal.app and type <code>vi</code>. This starts the editor in command mode. Type <code>i</code> to enter insert mode, and then you can begin typing text into the file. Copy the text from this article and paste it into vi, regular CMD-C / CMD-V will work just fine. This will give you something to work with.</p>
<p>Now that you&#8217;ve got some text, it&#8217;d probably be good to save it. Hit the escape key to put the editor back into command mode, and type <code>:w newfile.txt</code>. This will create a text file named <code>newfile.txt</code> in your home directory. Press <code>i</code> again, and you can begin typing, starting where you left off. Press escape again.</p>
<h3>Navigating Lines</h3>
<p>To move to any line of text in vi, you can press the number of the line you want to go to and <code>G</code>. For example, to go to the first line, type <code>1G</code>. If you type that and the characters &#8220;1G&#8221; show up on your screen, you are not in command mode, don&#8217;t forget to press escape first. To get back to the end of the file, you can just press <code>G</code> by itself. That will bring you to the start of the last line in the file.</p>
<ul>
<li>To get to the end of a line, you can press <code>$</code>, and your curser will jump to the end of the line.</li>
<li>To go to the beginning of the line, you press <code>^</code>. Now you can jump around the file.</li>
<li>To move the curser one character at a time, use the four keys <code>h j k</code> and <code>l</code>. <code>h</code> moves one character to the left, <code>j</code> moves one character to the right, <code>k</code> to moves one character up, and <code>l</code> moves one character down.</li>
<li>To open a line below, you can press <code>o</code>, and to open a line above, <code>O</code>.</li>
</ul>
<h3>Configuration File</h3>
<p>These basic text editing commands form the basis of the real strengths of vi, and the reason I continue to use it every day. But to really take advantage of the power of vi, you need to create a configuration file for shortcuts.</p>
<p>Exit out of vi and write the file to disk at the same time by typing <code>:wq!</code> while in command mode. Now, create a new file, and open the file in vi for editing by typing <code>vi .vimrc</code>. The .vimrc file is the configuration file vi reads when starting. The important thing to remember about this configuration file is that you can add any of the commands above into the file, including movement, inserting text, and opening lines, and then map those commands to a keyboard combo. If you are familiar with <a href="http://www.smileonmymac.com/TextExpander/">TextExpander</a>, you&#8217;ll follow right along with this concept, but it&#8217;s even stronger than that.</p>
<p>We are going to create a single line of text in the file that looks like this:<br />
<code>map ,a 1GiJack Doe^MGuy in Charge^MACME Inc.^M111 Main St.^MAnytown, USA </code></p>
<p><code> </code></p>
<p><code>^M^M^M^MDear Sir,^M^M^M^MSincerely,^M^M^MJohn Doe^[10G i</code></p>
<p>The line above has been separated into two lines to fit on the page.  When you see <code>^M</code>, that&#8217;s not really two characters, it&#8217;s only one. It&#8217;s the return key, captured in raw form in the config file for use in generating our commands. To capture it, you press Control-V, followed by return. The esc key is also captured above by pressing Control-V and then hitting the escape key. That creates the <code>^[</code> character above, and allows us to enter some of the vi commands above into the config. Enter in that line of text above, using the Control-V trick to capture the return and esc characters.</p>
<p>Now, save the new file by typing <code>:wq!</code> in command mode, open up a new file with <code>vi file</code>, and test out your new <code>,a</code> shortcut. If everything went well, it should look just like the video below.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/ES8u-T0ozKM&amp;hl=en&amp;fs=1&amp;rel=0" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube.com/v/ES8u-T0ozKM&amp;hl=en&amp;fs=1&amp;rel=0" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<h3>Worth Learning</h3>
<p>The learning curve with vi is steep, but as with most things worth learning, the payoff is significant. This short article has barely scratched the surface of what vi can do. vi can be a full-fledged IDE, or you could use it to write your next book. The mapping features above are especially helpful if you do any programming, or if you manage any Unix or Linux servers. If you&#8217;d like to learn more, I&#8217;d suggest starting with <code>man vi</code>, and maybe picking up a copy of the O&#8217;Reilly book &#8220;<a href="http://oreilly.com/catalog/9780596529833/">Learning the vi and Vim Editors</a>.&#8221; Of course, I&#8217;d be happy to help out as well.</p>
<p>Back when I was first learning Unix, I asked an old graybeard why I should bother learning such a complicated, ancient text editor. He told me that since everything in Unix is a file, and almost all files in Unix are text, I needed some way to edit those files to control the system. Someday, he said, I would find myself without any other text editor, and without any other way to change a file. He was right, since I&#8217;m now working as a Unix systems administrator, I&#8217;ve been in that position for several years. Over time, I&#8217;ve come to appreciate all that vi can do for me.</p>
<p><strong>Related research and analysis from GigaOM Pro:</strong><br />Subscriber content. <a href="http://pro.gigaom.com/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=172837+dig-into-unix-vi&utm_content=oszen">Sign up for a free trial</a>.</p><ul><li><a href="http://pro.gigaom.com/2011/03/why-ipad-2-will-lead-consumers-into-the-post-pc-era/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=172837+dig-into-unix-vi&utm_content=oszen">Why iPad 2 Will Lead Consumers Into the Post-PC&nbsp;Era</a></li><li><a href="http://pro.gigaom.com/2011/03/the-near-term-evolution-of-social-commerce/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=172837+dig-into-unix-vi&utm_content=oszen">The Near-Term Evolution of Social&nbsp;Commerce</a></li><li><a href="http://pro.gigaom.com/2011/02/content-farms-the-players-the-benefits-the-risks/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=172837+dig-into-unix-vi&utm_content=oszen">Content Farms: The Players, The Benefits, The&nbsp;Risks</a></li></ul><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gigaom.com&amp;blog=14960843&amp;post=172837&amp;subd=gigaom2&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gigaom.com/apple/dig-into-unix-vi/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7d5b8247e2eb580f5443ade7bbf2a067?s=96&#38;d=retro&#38;r=PG" medium="image">
			<media:title type="html">jBuys</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2009/06/terminal_icon.png" medium="image">
			<media:title type="html">terminal_icon</media:title>
		</media:content>
	</item>
		<item>
		<title>Dig Into Unix</title>
		<link>http://gigaom.com/apple/dig-into-unix/</link>
		<comments>http://gigaom.com/apple/dig-into-unix/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 20:00:51 +0000</pubDate>
		<dc:creator>Jon Buys</dc:creator>
				<category><![CDATA[CNN Big Tech]]></category>
		<category><![CDATA[NYT Enterprise]]></category>
		<category><![CDATA[SYN Feature Enterprise]]></category>
		<category><![CDATA[darwin]]></category>
		<category><![CDATA[dig into unix]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://theappleblog.com/?p=25093</guid>
		<description><![CDATA[When Apple revamped its operating system and adopted Nextstep as the base of OS X, they brought along with it an extremely powerful version of Unix based on the open-source project FreeBSD, now known as Darwin. Unix has a long history, one that started in the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gigaom.com&amp;blog=14960843&amp;post=172838&amp;subd=gigaom2&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img  title="terminal_icon" src="http://gigapple.files.wordpress.com/2009/06/terminal_icon.png?w=150&#038;h=150" alt="terminal_icon" width="150" height="150" class=" alignleft" /></p>
<p class="excerpt">When Apple revamped its operating system and adopted <a href="http://en.wikipedia.org/wiki/NeXTSTEP">Nextstep</a> as the base of OS X, they brought along with it an extremely powerful version of Unix based on the open-source project <a href="http://www.freebsd.org/">FreeBSD</a>, now known as <a href="http://developer.apple.com/referencelibrary/Darwin/">Darwin</a>.</p>
<p>Unix has a long history, one that started in the basements of Bell Labs by a group of AT&amp;T engineers some 40 years ago. A professor in a C programming course I took once said that they were supposed to be writing drivers for the AT&amp;T hardware, but instead, they wanted some way to use the system to play games, so they invented Unix.</p>
<p>Unix is now a mature and robust operating system, and since OS X is based on Unix, it has inherited all of its power, and some of its complexity. The beautiful <a href="http://developer.apple.com/macosx/architecture/index.html">aqua</a> interface that we are used to seeing is really all that is needed, but if you would like to take a look at what makes your computer tick, Apple included Terminal.app to act as a window into the GUI and into the Unix soul of OS X.</p>
<p>Nick started a <a href="http://gigaom.com/apple/unix-tip-remember-the-tab/">great series</a> back in January 2007 on this subject, and now I&#8217;d like to cover some of the basics again, and maybe bring a different point of view to the table as well. <span id="more-172838"></span></p>
<p style="text-align: center;"><img  title="Finding Terminal" src="http://gigapple.files.wordpress.com/2009/06/findingterminal.png?w=590&#038;h=343" alt="Finding Terminal" width="590" height="343" class=" alignleft" /></p>
<p>Open Terminal.app (found in Applications → Utilities), and you&#8217;ll see a window with a prompt waiting for you to start typing.</p>
<p style="text-align: center;"><img  title="Terminal" src="http://gigapple.files.wordpress.com/2009/06/terminal1.png?w=505&#038;h=367" alt="Terminal" width="505" height="367" class=" alignleft" /></p>
<p>At this point, it&#8217;s important to understand a few things about the Terminal. For one, the commands that you can type are interpreted and carried out immediately, no waiting around. So if you tell it to remove a file, it will do it right then, with no easy way of recovering it. There isn&#8217;t a recycle bin on the command line (not without a little coaxing, anyway). Secondly, since Unix was developed decades ago, many of the commands seem a bit archaic. Back when most of these utilities were written, they were all abbreviated to save space and cut down on the number of keystrokes you&#8217;d need to type. Below is a list of a few essentials, and another list from Nick&#8217;s post is <a href="http://gigaom.com/apple/unix-tip-commands/">here</a>.</p>
<ul>
<li><code>ls</code> (list): Probably one of the most important commands, it lets you see what&#8217;s in your current directory.</li>
<li><code>cd</code> (change directory): This is how you move about the filesystem in Unix, for example, to move from Library to Documents.</li>
<li><code>file</code>: This one isn&#8217;t short for anything, but it will give you a brief description of what a particular file is.</li>
<li><code>cat</code> (concatenate): Or &#8220;Grab everything in this file and let me read it.&#8221;</li>
<li><code><a href="http://gigaom.com/apple/unix-tip-its-a-man-man/">man</a></code> (manual): The online manual will describe most commands that you&#8217;re interested in; for example, typing <code>man ls</code> will give you the manual page about the <code>ls</code> command.</li>
</ul>
<p>It might be helpful to open a Finder window and put it right next to the Terminal. Open the Finder so it shows your home directory. Type <code>ls</code> in the Terminal to see the same files that you see in the Finder. Try another command: <code>touch</code>. <code>touch</code> is designed to change the last accessed timestamp of a file, but it will also create a blank file. You can see the file created in the Finder as well. You can cat the file, and see that there is nothing in it.</p>
<p>Now that you&#8217;ve created a file, and looked at its (blank) contents, you can remove the file using the <code>rm</code> command. This is one of those dangerous commands that, if used carelessly, can really screw things up. For this example, carefully type <code>rm file</code> into the terminal, and watch the file disappear in the Finder. You&#8217;ll notice that your Trash stays empty &#8212; that file is goners.</p>
<p>The Unix filesystem is a <a href="http://www.pathname.com/fhs/pub/fhs-2.3.html">nested hierarchy</a>, with each directory separated by a forward slash (<code>/</code>). The current working directory is symbolized as a dot (<code>.</code>), and the parent directory is symbolized by two dots (<code>..</code>). The top of the hierarchy, known as the root, is symbolized by a single forward slash.</p>
<p>So, to move to the parent directory, you could type <code>cd ..</code>. If you were in the Library directory and you typed this command, you would then be moved into your home directory. To see the very top of the hierarchy, you would type <code>cd /</code>. Type this command now.</p>
<p>Also, move in the Finder to the hard drive where you have OS X installed. I have mine named, originally, &#8220;OS X&#8221;.  Type <code>ls</code> in the Terminal, and you&#8217;ll notice a few more files than you can see in the Finder. These files are important Unix system files, and should not be touched unless you really know what you&#8217;re doing&#8230;and really, not even then. To illustrate the importance of these files, you could type <code>file mach_kernel</code>.</p>
<p><img  title="Terminal" src="http://gigapple.files.wordpress.com/2009/06/terminal_02.png?w=545&#038;h=407" alt="Terminal" width="545" height="407" class=" alignleft" /></p>
<p>This is the kernel, the core of the operating system. Do <strong>not</strong> mess with this file. Several of the other files are directories. You can change directories into <code>/bin</code>, for example, and type <code>ls</code> to list the contents of that directory. You&#8217;ll find a file in that directory named &#8220;ls,&#8221; which is the executable for the <code>ls</code> command. When you type <code>ls</code> into the terminal, it executes this tiny app. A great place to learn about Unix is to get a list of this directory, and then read the <code>man</code> page for every file listed.</p>
<p>To exit the Terminal, just CMD-Q like any other app, and you are back in the comforts of OS X.</p>
<p>This has been a very brief overview of how to go from absolutely no Unix knowledge whatsoever to the smallest amount of Unix knowledge necessary to poke around a bit. There&#8217;s a lot of power under there, but before you can really start to harness it, you need to get a decent understanding of the hows and whys.</p>
<p><strong>Related research and analysis from GigaOM Pro:</strong><br />Subscriber content. <a href="http://pro.gigaom.com/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=172838+dig-into-unix&utm_content=oszen">Sign up for a free trial</a>.</p><ul><li><a href="http://pro.gigaom.com/2011/03/why-ipad-2-will-lead-consumers-into-the-post-pc-era/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=172838+dig-into-unix&utm_content=oszen">Why iPad 2 Will Lead Consumers Into the Post-PC&nbsp;Era</a></li><li><a href="http://pro.gigaom.com/2011/03/the-near-term-evolution-of-social-commerce/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=172838+dig-into-unix&utm_content=oszen">The Near-Term Evolution of Social&nbsp;Commerce</a></li><li><a href="http://pro.gigaom.com/2011/02/content-farms-the-players-the-benefits-the-risks/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=172838+dig-into-unix&utm_content=oszen">Content Farms: The Players, The Benefits, The&nbsp;Risks</a></li></ul><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gigaom.com&amp;blog=14960843&amp;post=172838&amp;subd=gigaom2&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gigaom.com/apple/dig-into-unix/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7d5b8247e2eb580f5443ade7bbf2a067?s=96&#38;d=retro&#38;r=PG" medium="image">
			<media:title type="html">jBuys</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2009/06/terminal_icon.png" medium="image">
			<media:title type="html">terminal_icon</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2009/06/findingterminal.png" medium="image">
			<media:title type="html">Finding Terminal</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2009/06/terminal1.png" medium="image">
			<media:title type="html">Terminal</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2009/06/terminal_02.png" medium="image">
			<media:title type="html">Terminal</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting A Handle On Your iPhone Data (A Mini-Tales From The Command Line Story)</title>
		<link>http://gigaom.com/apple/getting-a-handle-on-your-iphone-data-a-mini-tales-from-the-command-line-story/</link>
		<comments>http://gigaom.com/apple/getting-a-handle-on-your-iphone-data-a-mini-tales-from-the-command-line-story/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 15:00:49 +0000</pubDate>
		<dc:creator>Bob Rudis</dc:creator>
				<category><![CDATA[Asides]]></category>
		<category><![CDATA[Commentary]]></category>
		<category><![CDATA[Software Reviews]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[ecamm]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[phoneview]]></category>
		<category><![CDATA[sms]]></category>
		<category><![CDATA[sqlite]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://theappleblog.com/?p=4194</guid>
		<description><![CDATA[The past two weeks have been fairly hectic, with little time to deal with anything but security updates to software (hence, no software update news). This week, however, my iPhone needed some serious care and feeding as it was taking forever to load up the SMS [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gigaom.com&amp;blog=14960843&amp;post=171600&amp;subd=gigaom2&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img src="http://gigapple.files.wordpress.com/2008/08/phoneview-icon.png?w=128&#038;h=128" alt="" title="phoneview-icon" width="128" height="128"  class=" alignleft" />The past two weeks have been fairly hectic, with little time to deal with anything but security updates to software (hence, no software update news). This week, however, my iPhone needed some serious care and feeding as it was taking forever to load up the SMS screens since I have saved most every SMS I have received since purchasing the phone last July. Despite the iPhone using <a href="http://www.sqlite.org/">SQLite</a> as the foundation information store for items such as SMS messages and Contacts, a large number of entries in these repositories seems to slow the associated user interfaces to a crawl (which is probably an app/UI issue more than it is a database issue). Rather than just clear the extended conversations, I wanted to have an accessible, readable backup of them first.</p>
<p>I turned to Ecamm&#8217;s <a href="http://www.ecamm.com/mac/phoneview/">PhoneView</a> program as it has been much Twittered about lately and is from the makers of the most excellent <a href="http://www.ecamm.com/mac/callrecorder/">Call Recorder</a> software (highly useful for Skype interviews). Along with providing access to SMS history (which is what I really wanted) it also claims to provide easy access to your iTunes media, photos, notes, call history and contacts, including the ability to drag and drop each file from the iPhone to your desktop.<br />
<span id="more-171600"></span><br />
After downloading the trial version, just plug in your iPhone and it will automagically recognize the device and load up the data from it:</p>
<div style="padding-bottom:12px; text-align:center"><a href="http://gigapple.files.wordpress.com/2008/08/phone-view-main.png"><img src="http://gigapple.files.wordpress.com/2008/08/phone-view-main.png?w=500&#038;h=340" alt="" title="phone-view-main" width="500" height="340"  class=" alignleft" /></a></div>
<p>While I will not be showing the SMS retrieval portion (it would pretty much be a gigantic redacted block), the notes feature,</p>
<div style="padding-bottom:12px; text-align:center"><a href="http://gigapple.files.wordpress.com/2008/08/phone-view-new-note.png"><img src="http://gigapple.files.wordpress.com/2008/08/phone-view-new-note.png?w=500&#038;h=311" alt="" title="phone-view-new-note" width="500" height="311"  class=" alignleft" /></a></div>
<p>call history feature (with export to tab-delimited file capability),</p>
<div style="padding-bottom:12px; text-align:center"><a href="http://gigapple.files.wordpress.com/2008/08/phone-view-new-call-log.png"><img src="http://gigapple.files.wordpress.com/2008/08/phone-view-new-call-log.png?w=500&#038;h=391" alt="" title="phone-view-new-call-log" width="500" height="391"  class=" alignleft" /></a></div>
<p>and disk view mode make it a very handy tool.</p>
<div style="padding-bottom:12px; text-align:center"><a href="http://gigapple.files.wordpress.com/2008/08/phone-view-disk-view.png"><img src="http://gigapple.files.wordpress.com/2008/08/phone-view-disk-view.png?w=500&#038;h=391" alt="" title="phone-view-disk-view" width="500" height="391"  class=" alignleft" /></a></div>
<p>This is one app where I highly recommend tweaking the default preferences since it will come up each time you connect your iPhone if you do not disable that ability.</p>
<div style="padding-bottom:12px; text-align:center"><a href="http://gigapple.files.wordpress.com/2008/08/phone-view-prefs.png"><img src="http://gigapple.files.wordpress.com/2008/08/phone-view-prefs.png?w=397&#038;h=162" alt="" title="phone-view-prefs" width="397" height="162"  class=" alignleft" /></a></div>
<p>I was all set to purchase PhoneView, but kept having shopping cart issues and really wanted to get the SMS bits off of it prior to both clearing the SMS databases and installing iPhone OS 2.0.2, so I turned to a less interactive solution that requires a bit of command-line-fu.</p>
<p>First, grab <a href="http://calmstorm.net/iphone/unravel.perl">unravel</a>, a small Perl script which you will use to rifle through your iPhone backup files (which are liberally generated these days). Then, using the Finder&#8217;s &#8220;Go to Folder&#8230;&#8221; option (via the &#8220;Go&#8221; menu), enter: <code>~/Library/Application Support/MobileSync/Backup</code></p>
<div style="padding-bottom:12px; text-align:center"><a href="http://gigapple.files.wordpress.com/2008/08/go-to-folder-backup.png"><img src="http://gigapple.files.wordpress.com/2008/08/go-to-folder-backup.png?w=431&#038;h=134" alt="" title="go-to-folder-backup" width="431" height="134"  class=" alignleft" /></a></div>
<p>Each of the weirdly named directories contains various backups of your iPhone data. Copy the Perl script to the most recently modified folder. Now, you <i>will</i> need the full path of that folder to continue and I suggest using either the Finder toolbar or keyboard-shortcut version of <a href="http://www.entropy.ch/blog/Mac+OS+X/2008/08/07/Open-Terminal-Here-Finder-Keyboard-Command.html">Open Terminal Here</a> to make your life much easier. Either manually, or via &#8220;Open Terminal Here&#8221;, fire up Terminal.app, change directories and run the Perl script (yours may be named <code>unravel.perl.pl</code> or <code>unravel.perl</code> depending on how you or your browser saved it).</p>
<div style="padding-bottom:12px; text-align:center"><a href="http://gigapple.files.wordpress.com/2008/08/unravel-run.png"><img src="http://gigapple.files.wordpress.com/2008/08/unravel-run.png?w=500&#038;h=248" alt="" title="unravel-run" width="500" height="248"  class=" alignleft" /></a></div>
<p>You can browse the results by going to <code>~/iPhone/Backup</code> in the Finder. The SMS database is in <code>~/iPhone/Backup/Library/SMS</code> and I recommend grabbing the open source <a href="http://sourceforge.net/projects/sqlitebrowser/">SQLite Database Browser</a> to look at and export any of the SQLite databases.</p>
<div style="padding-bottom:12px; text-align:center"><a href="http://gigapple.files.wordpress.com/2008/08/sqlite-browser.png"><img src="http://gigapple.files.wordpress.com/2008/08/sqlite-browser.png?w=500&#038;h=362" alt="" title="sqlite-browser" width="500" height="362"  class=" alignleft" /></a></div>
<p>If you can get through Ecamm&#8217;s shopping cart, the $19.95USD is a pretty good deal as it gives you a decent interface and free upgrades for life. If you just need to grab information once in a while or have some casual interest in what can be pulled from the iPhone backup files, then <code>unravel</code> may be a good option for you.</p>
<p>What extra tools do you use to manage your iPhone data? If you&#8217;ve used <code>unravel</code> or PhoneView, sound off in the comments!</p>
<p><strong>Related research and analysis from GigaOM Pro:</strong><br />Subscriber content. <a href="http://pro.gigaom.com/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=171600+getting-a-handle-on-your-iphone-data-a-mini-tales-from-the-command-line-story&utm_content=hrbrmstr">Sign up for a free trial</a>.</p><ul><li><a href="http://pro.gigaom.com/2011/01/mobile-q4-all-eyes-were-on-android-4g-and-the-rising-tablet-tide/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=171600+getting-a-handle-on-your-iphone-data-a-mini-tales-from-the-command-line-story&utm_content=hrbrmstr">Mobile Q4: All Eyes Were on Android, 4G and the Rising Tablet&nbsp;Tide</a></li><li><a href="http://pro.gigaom.com/2010/12/report-a-mobile-video-market-overview/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=171600+getting-a-handle-on-your-iphone-data-a-mini-tales-from-the-command-line-story&utm_content=hrbrmstr">Report: A Mobile Video Market&nbsp;Overview</a></li><li><a href="http://pro.gigaom.com/2010/10/in-q3-the-tablet-and-4g-were-the-big-stories/?utm_source=apple&utm_medium=editorial&utm_campaign=auto3&utm_term=171600+getting-a-handle-on-your-iphone-data-a-mini-tales-from-the-command-line-story&utm_content=hrbrmstr">In Q3, the Tablet and 4G Were the Big&nbsp;Stories</a></li></ul><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gigaom.com&amp;blog=14960843&amp;post=171600&amp;subd=gigaom2&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://gigaom.com/apple/getting-a-handle-on-your-iphone-data-a-mini-tales-from-the-command-line-story/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a08d08f6b541441fccf36bc6392a0784?s=96&#38;d=retro&#38;r=PG" medium="image">
			<media:title type="html">hrbrmstr</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2008/08/phoneview-icon.png" medium="image">
			<media:title type="html">phoneview-icon</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2008/08/phone-view-main.png" medium="image">
			<media:title type="html">phone-view-main</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2008/08/phone-view-new-note.png" medium="image">
			<media:title type="html">phone-view-new-note</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2008/08/phone-view-new-call-log.png" medium="image">
			<media:title type="html">phone-view-new-call-log</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2008/08/phone-view-disk-view.png" medium="image">
			<media:title type="html">phone-view-disk-view</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2008/08/phone-view-prefs.png" medium="image">
			<media:title type="html">phone-view-prefs</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2008/08/go-to-folder-backup.png" medium="image">
			<media:title type="html">go-to-folder-backup</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2008/08/unravel-run.png" medium="image">
			<media:title type="html">unravel-run</media:title>
		</media:content>

		<media:content url="http://gigapple.files.wordpress.com/2008/08/sqlite-browser.png" medium="image">
			<media:title type="html">sqlite-browser</media:title>
		</media:content>
	</item>
	</channel>
</rss>
