<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>langui.sh &#187; bash</title>
	<atom:link href="http://langui.sh/tag/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://langui.sh</link>
	<description>Fun hacks, WP plugins, photography, and PKI junk.  Languishing since 2008.</description>
	<lastBuildDate>Tue, 20 Jul 2010 22:12:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>Fixing GrowlMail in 10.6.4 (Mail 4.3)</title>
		<link>http://langui.sh/2010/06/15/fixing-growlmail-in-10-6-4-mail-4-3/</link>
		<comments>http://langui.sh/2010/06/15/fixing-growlmail-in-10-6-4-mail-4-3/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 21:41:17 +0000</pubDate>
		<dc:creator>Paul Kehrer</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[growlmail]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[mail]]></category>

		<guid isPermaLink="false">http://langui.sh/?p=1129</guid>
		<description><![CDATA[Another OS X release, another broken GrowlMail bundle. I did a post just like this for 10.6.2. Check it out if you want more background on why this occurs. Easy Fix Download a pre-patched GrowlMail.bundle and drop it in your ~/Library/Mail/Bundles/ directory1. If you want it available to multiple users on your system, use /Library/Mail/Bundles/. [...]]]></description>
			<content:encoded><![CDATA[<p>Another OS X release, another broken GrowlMail bundle.  I did a post just like this for 10.6.2.  <a href="/2009/11/09/fixing-growlmail-letterbox-for-mail-4-2/" target="_blank">Check it out</a> if you want more background on why this occurs.</p>
<h3>Easy Fix</h3>
<p>Download a pre-patched GrowlMail.bundle and drop it in your ~/Library/Mail/Bundles/ directory<sup class='footnote'><a href='#fn-1129-1' id='fnref-1129-1'>1</a></sup>.  If you want it available to multiple users on your system, use /Library/Mail/Bundles/.</p>
<p><b><a href="http://cdn.langui.sh/2010/06/GrowlMail.mailbundle.zip">Download patched bundle</a></b></p>
<p>If you use this method you&#8217;re all set; no need to use the command line solution below.</p>
<h3>Add New UUIDs to SupportedPluginCompatibilityUUIDs</h3>
<p>If you have already had your plugins disabled by opening Mail.app you&#8217;ll need to look in ~/Library/Mail (or /Library/Mail if you installed globally) and move the files back to the active bundles directory.  They&#8217;ll typically be in Bundles (Disabled), so quit Mail, find them, and move them back into the proper directory.</p>
<p>If you have a local installation:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">defaults <span style="color: #c20cb9; font-weight: bold;">write</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Mail<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>GrowlMail.mailbundle<span style="color: #000000; font-weight: bold;">/</span>Contents<span style="color: #000000; font-weight: bold;">/</span>Info SupportedPluginCompatibilityUUIDs <span style="color: #660033;">-array-add</span> <span style="color: #ff0000;">&quot;E71BD599-351A-42C5-9B63-EA5C47F7CE8E&quot;</span>
defaults <span style="color: #c20cb9; font-weight: bold;">write</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Mail<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>GrowlMail.mailbundle<span style="color: #000000; font-weight: bold;">/</span>Contents<span style="color: #000000; font-weight: bold;">/</span>Info SupportedPluginCompatibilityUUIDs <span style="color: #660033;">-array-add</span> <span style="color: #ff0000;">&quot;B842F7D0-4D81-4DDF-A672-129CA5B32D57&quot;</span></pre></div></div>

<p>Global installation:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">defaults <span style="color: #c20cb9; font-weight: bold;">write</span> <span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Mail<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>GrowlMail.mailbundle<span style="color: #000000; font-weight: bold;">/</span>Contents<span style="color: #000000; font-weight: bold;">/</span>Info SupportedPluginCompatibilityUUIDs <span style="color: #660033;">-array-add</span> <span style="color: #ff0000;">&quot;E71BD599-351A-42C5-9B63-EA5C47F7CE8E&quot;</span>
defaults <span style="color: #c20cb9; font-weight: bold;">write</span> <span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Mail<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>GrowlMail.mailbundle<span style="color: #000000; font-weight: bold;">/</span>Contents<span style="color: #000000; font-weight: bold;">/</span>Info SupportedPluginCompatibilityUUIDs <span style="color: #660033;">-array-add</span> <span style="color: #ff0000;">&quot;B842F7D0-4D81-4DDF-A672-129CA5B32D57&quot;</span></pre></div></div>

<div class='footnotes'>
<div class='footnotedivider'></div>
<ol>
<li id='fn-1129-1'>~ means your home directory if you&#8217;re unfamiliar with the syntax. You can click the home icon on your Finder sidebar if you&#8217;re still confused <span class='footnotereverse'><a href='#fnref-1129-1'>&#8617;</a></span></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://langui.sh/2010/06/15/fixing-growlmail-in-10-6-4-mail-4-3/feed/</wfw:commentRss>
		<slash:comments>75</slash:comments>
		</item>
		<item>
		<title>Bash Productivity Enhancers</title>
		<link>http://langui.sh/2010/01/20/bash-productivity-enhancers/</link>
		<comments>http://langui.sh/2010/01/20/bash-productivity-enhancers/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 17:35:20 +0000</pubDate>
		<dc:creator>Paul Kehrer</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://langui.sh/?p=1043</guid>
		<description><![CDATA[Bash is an extremely powerful shell, but its shortcuts are not readily apparent. Here are a few shortcuts and tips that I&#8217;ve noticed many (already proficient) bash users are not aware of. You can also check out Improved Bash History and More Useful Bash/Terminal Settings for more ideas for improving your bash productivity. Bash Navigation [...]]]></description>
			<content:encoded><![CDATA[<p>Bash is an extremely powerful shell, but its shortcuts are not readily apparent.  Here are a few shortcuts and tips that I&#8217;ve noticed many (already proficient) bash users are not aware of.  You can also check out <a href="http://langui.sh/2009/10/30/improved-bash-history/" target="_blank">Improved Bash History</a> and <a href="http://langui.sh/2009/11/02/more-useful-bashterminal-settings/">More Useful Bash/Terminal Settings</a> for more ideas for improving your bash productivity.</p>
<h2>Bash Navigation Shortcuts</h2>
<p>When editing a long command, there are quite a few navigation and editing shortcuts.  By default bash typically operates in emacs mode.</p>
<ul>
<li>Ctrl-A to go to the beginning of the line</li>
<li>Ctrl-E to go to the end of a line.</li>
<li>Ctrl-W will cut the current word (searching backward)</li>
<li>Ctrl-U will cut everything before the cursor</li>
<li>Ctrl-K cuts everything after the cursor</li>
<li>Ctrl-Y pastes the last text that was cut</li>
<li>Ctrl-T swaps the order of the last two characters entered<sup class='footnote'><a href='#fn-1043-1' id='fnref-1043-1'>1</a></sup></li>
<li>Meta-B will move the cursor back one word</li>
<li>Meta-F will move the cursor forward one word</li>
</ul>
<p>Meta keys are a bit tricky since they can differ based on your terminal application.  On Windows/Linux it is typically Alt and on Mac OS X Terminal.app defaults to using Esc (but you can change it to option/alt in the preferences).</p>
<p>However, bash also has a <b>vi/vim editing mode</b>.  To enable this type &#8220;set -o vi&#8221;.  At this point all the typical vi shortcuts are available if you enter command mode (by hitting Esc).  I don&#8217;t recommend using this unless you are very comfortable with vi already.</p>
<h2>reverse-i-search</h2>
<p>You can search through your history and rapidly find a command used previously with reverse-i-search.  To invoke, press Ctrl-R and start typing.  If you have multiple matches, hit Ctrl-R to cycle through them all.  When coupled with an <a href="http://langui.sh/2009/10/30/improved-bash-history/" target="_blank">improved bash history</a> this is an extraordinarily useful tool.</p>
<h2>Controlling Tasks in Bash</h2>
<p>Bash allows you to stop, background, and foreground tasks.  To background a process before it starts simply add &#038; to the end of your command.<sup class='footnote'><a href='#fn-1043-2' id='fnref-1043-2'>2</a></sup></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mycommand <span style="color: #000000; font-weight: bold;">&amp;</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000;">1922</span></pre></div></div>

<p>If you have an already running task and you&#8217;d like to stop it press Ctrl-Z.  This task will obtain a job number (the number in brackets).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>+  Stopped                 mycommand</pre></div></div>

<p>You can then resume the task in the foreground with <b>fg #</b> or background it with <b>bg #</b>.   To see a list of jobs that have been backgrounded or stopped type <b>jobs</b>.</p>
<h2>Redirecting stderr/stdout in Bash</h2>
<p>Bash has two main output buffers: stderr and stdout.  Both of these, by default, output to your terminal window.</p>
<ul>
<li>To redirect stdout to a file add <b>&gt; /path/to/output</b></li>
<li>To redirect stderr to a file add <b>2&gt; /path/to/output</b></li>
<li>To redirect stderr into stdout add <b>2&gt;&amp;1</b></li>
</ul>
<div class='footnotes'>
<div class='footnotedivider'></div>
<ol>
<li id='fn-1043-1'>This shortcut is available in both emacs and vi mode, but I&#8217;ve placed it here since it uses the Control key. <span class='footnotereverse'><a href='#fnref-1043-1'>&#8617;</a></span></li>
<li id='fn-1043-2'>Output from stdout and stderr will continue to appear in your terminal, so consider redirecting them if needed. <span class='footnotereverse'><a href='#fnref-1043-2'>&#8617;</a></span></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://langui.sh/2010/01/20/bash-productivity-enhancers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fixing GrowlMail for Mail 4.2</title>
		<link>http://langui.sh/2009/11/09/fixing-growlmail-letterbox-for-mail-4-2/</link>
		<comments>http://langui.sh/2009/11/09/fixing-growlmail-letterbox-for-mail-4-2/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 22:50:00 +0000</pubDate>
		<dc:creator>Paul Kehrer</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[mail]]></category>

		<guid isPermaLink="false">http://langui.sh/?p=811</guid>
		<description><![CDATA[Update: Fix for 10.6.4 and Mail 4.3 Lately Apple has been revving the version number (and plugin compatibility UUID) of Mail.app with every version of 10.6. This breaks bundles like GrowlMail even when they are still compatible. The easy fix (although not necessarily the best if it turns out an update is required!) is to [...]]]></description>
			<content:encoded><![CDATA[<p><b>Update: Fix for <a href="http://langui.sh/2010/06/15/fixing-growlmail-in-10-6-4-mail-4-3/">10.6.4 and Mail 4.3</a></b></p>
<p>Lately Apple has been revving the version number (and plugin compatibility UUID) of Mail.app with every version of 10.6.  This breaks bundles like GrowlMail even when they are still compatible.  The easy fix (although not necessarily the best if it turns out an update is required!) is to run a few commands in Terminal to add the new UUIDs<sup class='footnote'><a href='#fn-811-1' id='fnref-811-1'>1</a></sup> to the SupportedPluginCompatibilityUUID key in the Info.plist.<sup class='footnote'><a href='#fn-811-2' id='fnref-811-2'>2</a></sup></p>
<p><b>If you have already had your plugins disabled by opening Mail.app you&#8217;ll need to look in ~/Library/Mail (or /Library/Mail if you installed globally) and move the files back to the active bundles directory.  They&#8217;ll typically be in Bundles (Disabled), so quit Mail, find them, and move them back into the proper directory.</b></p>
<p>Once you&#8217;ve gotten the files moved into the proper location use either the local installation or global installation commands below (depending on where you found your bundles).  To run them, simply copy/paste them into a Terminal window.<sup class='footnote'><a href='#fn-811-3' id='fnref-811-3'>3</a></sup></p>
<p>For GrowlMail (assuming local installation)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">defaults <span style="color: #c20cb9; font-weight: bold;">write</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Mail<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>GrowlMail.mailbundle<span style="color: #000000; font-weight: bold;">/</span>Contents<span style="color: #000000; font-weight: bold;">/</span>Info SupportedPluginCompatibilityUUIDs <span style="color: #660033;">-array-add</span> <span style="color: #ff0000;">&quot;2F0CF6F9-35BA-4812-9CB2-155C0FDB9B0F&quot;</span>
defaults <span style="color: #c20cb9; font-weight: bold;">write</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Mail<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>GrowlMail.mailbundle<span style="color: #000000; font-weight: bold;">/</span>Contents<span style="color: #000000; font-weight: bold;">/</span>Info SupportedPluginCompatibilityUUIDs <span style="color: #660033;">-array-add</span> <span style="color: #ff0000;">&quot;0CB5F2A0-A173-4809-86E3-9317261F1745&quot;</span></pre></div></div>

<p>For GrowlMail (global installation)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">defaults <span style="color: #c20cb9; font-weight: bold;">write</span> <span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Mail<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>GrowlMail.mailbundle<span style="color: #000000; font-weight: bold;">/</span>Contents<span style="color: #000000; font-weight: bold;">/</span>Info SupportedPluginCompatibilityUUIDs <span style="color: #660033;">-array-add</span> <span style="color: #ff0000;">&quot;2F0CF6F9-35BA-4812-9CB2-155C0FDB9B0F&quot;</span>
defaults <span style="color: #c20cb9; font-weight: bold;">write</span> <span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Mail<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>GrowlMail.mailbundle<span style="color: #000000; font-weight: bold;">/</span>Contents<span style="color: #000000; font-weight: bold;">/</span>Info SupportedPluginCompatibilityUUIDs <span style="color: #660033;">-array-add</span> <span style="color: #ff0000;">&quot;0CB5F2A0-A173-4809-86E3-9317261F1745&quot;</span></pre></div></div>

<p>Update: <a href="http://harnly.net/2009/software/letterbox/letterbox-beta-5-for-snow-leopard/#more-240">Letterbox has been updated</a>, but the above instructions can be adapted for any future OS update that breaks compatibility.</p>
<p><b>Update 2: You can <a href='http://cdn.langui.sh/2009/11/GrowlMail.mailbundle.zip'>download</a> a pre-patched copy if you don&#8217;t want to follow the above instructions.  Just unzip it and drop it in your bundles directory.</b></p>
<p><b>Update 3: <a href="http://growl.info/growlmail/">GrowlMail 1.2.1</a> has been released, which fixes 10.6.2 compatibility.  This issue will likely occur again with 10.6.3 though!</b>
<div class='footnotes'>
<div class='footnotedivider'></div>
<ol>
<li id='fn-811-1'>2F0CF6F9-35BA-4812-9CB2-155C0FDB9B0F for Mail.app v4.2 and 0CB5F2A0-A173-4809-86E3-9317261F1745 for the Message framework.  These were released with OS X 10.6.2. <span class='footnotereverse'><a href='#fnref-811-1'>&#8617;</a></span></li>
<li id='fn-811-2'> These UUIDs can be found in /Applications/Mail.app/Contents/Info.plist and /System/Library/Frameworks/Message.framework/Resources/Info.plist for when they inevitably change again. <span class='footnotereverse'><a href='#fnref-811-2'>&#8617;</a></span></li>
<li id='fn-811-3'>Terminal is found in /Applications/Utilities if you&#8217;ve never used it before.  You&#8217;ll see a prompt and you can paste the commands in and hit enter. <span class='footnotereverse'><a href='#fnref-811-3'>&#8617;</a></span></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://langui.sh/2009/11/09/fixing-growlmail-letterbox-for-mail-4-2/feed/</wfw:commentRss>
		<slash:comments>63</slash:comments>
		</item>
		<item>
		<title>Find A Matching Certificate And Key Pair</title>
		<link>http://langui.sh/2009/11/08/find-a-matching-certificate-and-key-pair/</link>
		<comments>http://langui.sh/2009/11/08/find-a-matching-certificate-and-key-pair/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 02:49:21 +0000</pubDate>
		<dc:creator>Paul Kehrer</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[openssl]]></category>

		<guid isPermaLink="false">http://langui.sh/?p=806</guid>
		<description><![CDATA[If you have a list of keys and SSL certs and don&#8217;t know which cert belongs with which key, here&#8217;s a script for you. It&#8217;s not efficient (nested for loop!), but it gets the job done quickly.1 #!/bin/bash for i in `ls *.key` do key_mod=`openssl rsa -noout -in $i -modulus` for j in `ls *.cer` [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a list of keys and SSL certs and don&#8217;t know which cert belongs with which key, here&#8217;s a script for you.  It&#8217;s not efficient (nested for loop!), but it gets the job done quickly.<sup class='footnote'><a href='#fn-806-1' id='fnref-806-1'>1</a></sup></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">*</span>.key<span style="color: #000000; font-weight: bold;">`</span> 
<span style="color: #000000; font-weight: bold;">do</span>
<span style="color: #007800;">key_mod</span>=<span style="color: #000000; font-weight: bold;">`</span>openssl rsa <span style="color: #660033;">-noout</span> <span style="color: #660033;">-in</span> <span style="color: #007800;">$i</span> -modulus<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">for</span> j <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">*</span>.cer<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">do</span>
<span style="color: #007800;">x509_mod</span>=<span style="color: #000000; font-weight: bold;">`</span>openssl x509 <span style="color: #660033;">-noout</span> <span style="color: #660033;">-in</span> <span style="color: #007800;">$j</span> -modulus<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$x509_mod</span>&quot;</span> == <span style="color: #ff0000;">&quot;<span style="color: #007800;">$key_mod</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$j</span> matches <span style="color: #007800;">$i</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span> 
<span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<div class='footnotes'>
<div class='footnotedivider'></div>
<ol>
<li id='fn-806-1'>If bash allowed multidimensional or associative arrays this would be trivial to optimize. <span class='footnotereverse'><a href='#fnref-806-1'>&#8617;</a></span></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://langui.sh/2009/11/08/find-a-matching-certificate-and-key-pair/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More Useful Bash/Terminal Settings</title>
		<link>http://langui.sh/2009/11/02/more-useful-bashterminal-settings/</link>
		<comments>http://langui.sh/2009/11/02/more-useful-bashterminal-settings/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 16:28:20 +0000</pubDate>
		<dc:creator>Paul Kehrer</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://langui.sh/?p=751</guid>
		<description><![CDATA[A few more tricks to make your bash environment better. As always, add them to your ~/.profile or ~/.bash_profile to enable. Disable the pagination of long lists when ambiguously tab completing. bind 'set page-completions off' Increase max returned items before being prompted. (ie, &#8220;Display all 380 possibilities? (y or n&#8221;). You can set the number [...]]]></description>
			<content:encoded><![CDATA[<p>A few more tricks to make your bash environment better.  As always, add them to your ~/.profile or ~/.bash_profile to enable.</p>
<p>Disable the pagination of long lists when ambiguously tab completing.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">bind</span> <span style="color: #ff0000;">'set page-completions off'</span></pre></div></div>

<p>Increase max returned items before being prompted.  (ie, &#8220;Display all 380 possibilities? (y or n&#8221;).  You can set the number to whatever you&#8217;d like.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">bind</span> <span style="color: #ff0000;">'set completion-query-items 300'</span></pre></div></div>

<p>Show the list of autocompletion options after the first tab.  This prevents the beep + second tab behavior.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">bind</span> <span style="color: #ff0000;">'set show-all-if-ambiguous on'</span></pre></div></div>

<p>When autocompleting for cd or rmdir, list only directories as choices.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">complete</span> <span style="color: #660033;">-d</span> <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #c20cb9; font-weight: bold;">rmdir</span></pre></div></div>

<p>Autocompletion for ssh known_hosts.  Add this to your ~/.ssh/config (if the file doesn&#8217;t exist, create it)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Host <span style="color: #000000; font-weight: bold;">*</span>
HashKnownHosts no</pre></div></div>

<p>Make grep highlight the matching terms in its output.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GREP_OPTIONS</span>=<span style="color: #ff0000;">'--color=auto'</span></pre></div></div>

<p>Ignore case for case preserving but insensitive filesystems (like HFS+).  I don&#8217;t personally use this, but perhaps some people will like it.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">bind</span> <span style="color: #ff0000;">'set completion-ignore-case on'</span></pre></div></div>

<p>Don&#8217;t show hidden files when listing.  Another option I don&#8217;t personally use.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">bind</span> <span style="color: #ff0000;">'set match-hidden-files off'</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://langui.sh/2009/11/02/more-useful-bashterminal-settings/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Improved Bash History</title>
		<link>http://langui.sh/2009/10/30/improved-bash-history/</link>
		<comments>http://langui.sh/2009/10/30/improved-bash-history/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 19:45:12 +0000</pubDate>
		<dc:creator>Paul Kehrer</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://langui.sh/?p=732</guid>
		<description><![CDATA[If you use multiple shells simultaneously (in my case with Terminal.app on OS X) you&#8217;ve undoubtedly noticed that the history of the last closed shell clobbers any commands you might have executed in others. This makes it difficult to use reverse-i-search to find commands you recall using. However, with a few modifications to your bash [...]]]></description>
			<content:encoded><![CDATA[<p>If you use multiple shells simultaneously (in my case with Terminal.app on OS X) you&#8217;ve undoubtedly noticed that the history of the last closed shell clobbers any commands you might have executed in others.  This makes it difficult to use reverse-i-search to find commands you recall using.  However, with a few modifications to your bash history you can greatly increase its utility.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTCONTROL</span>=erasedups
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTSIZE</span>=<span style="color: #000000;">10000</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTTIMEFORMAT</span>=<span style="color: #ff0000;">&quot;%D %T &quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HISTIGNORE</span>=<span style="color: #ff0000;">&quot;&amp;:ls:exit&quot;</span>
<span style="color: #7a0874; font-weight: bold;">shopt</span> <span style="color: #660033;">-s</span> histappend</pre></div></div>

<p>Save the above lines to your home directory&#8217;s .profile (or .bash_profile) and your shell history will now prevent duplicates, have a maximum of 10,000 items, append a timestamp to all new commands, exclude a list of commands, and append history between shells.</p>
]]></content:encoded>
			<wfw:commentRss>http://langui.sh/2009/10/30/improved-bash-history/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>RAM Disks in OS X</title>
		<link>http://langui.sh/2009/04/21/ram-disks-in-os-x/</link>
		<comments>http://langui.sh/2009/04/21/ram-disks-in-os-x/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 02:50:22 +0000</pubDate>
		<dc:creator>Paul Kehrer</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://langui.sh/?p=547</guid>
		<description><![CDATA[If you&#8217;ve ever wanted to set up a ramdisk in Mac OS X, here&#8217;s a quick script you can use. Simply invoke it with a size in MB and the name for your volume and it will create and automount it for you. It also won&#8217;t leave any dangling directories in your /Volumes/ when you [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever wanted to set up a ramdisk in Mac OS X, here&#8217;s a quick script you can use.  Simply invoke it with a size in MB and the name for your volume and it will create and automount it for you.  It also won&#8217;t leave any dangling directories in your /Volumes/ when you eject it!  Be sure to chmod the file you place the script in to make it executable (755 or likewise).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;$3&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> <span style="color: #007800;">NUM_ARG</span>=ERR; <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> <span style="color: #007800;">NUM_ARG</span>=ERR; <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$NUM_ARG</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;
<span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'Usage: ./ramdisk &lt;size in MB&gt; &lt;name, optional&gt;'</span>
<span style="color: #7a0874; font-weight: bold;">exit</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #007800;">SIZE</span>=$<span style="color: #000000;">1</span>
<span style="color: #007800;">NAME</span>=<span style="color: #ff0000;">'my_ramdisk'</span>
<span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;SIZE *= 2048&quot;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;$2&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span> <span style="color: #007800;">NAME</span>=$<span style="color: #000000;">2</span>; <span style="color: #000000; font-weight: bold;">fi</span>
diskutil erasevolume HFS+ <span style="color: #ff0000;">&quot;<span style="color: #007800;">$NAME</span>&quot;</span> <span style="color: #000000; font-weight: bold;">`</span>hdiutil attach <span style="color: #660033;">-nomount</span> ram:<span style="color: #000000; font-weight: bold;">//</span><span style="color: #800000;">${SIZE}</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'Done'</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://langui.sh/2009/04/21/ram-disks-in-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Color Terminal in OS X</title>
		<link>http://langui.sh/2009/01/01/color-terminal-in-os-x/</link>
		<comments>http://langui.sh/2009/01/01/color-terminal-in-os-x/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 05:56:09 +0000</pubDate>
		<dc:creator>Paul Kehrer</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://langui.sh/?p=25</guid>
		<description><![CDATA[Apple ships OS X without ls set to use colors (and sans the useful ll alias). For those of us who have grown to love the instant delineation between directories, symlinks, and files this is an inconvenience. Luckily, adding this is quite simple. Place the following into your ~/.profile and you&#8217;re all set. To change [...]]]></description>
			<content:encoded><![CDATA[<p>Apple ships OS X without ls set to use colors (and sans the useful ll alias).  For those of us who have grown to love the instant delineation between directories, symlinks, and files this is an inconvenience.  Luckily, adding this is quite simple.  Place the following into your ~/.profile and you&#8217;re all set.  To change this setting for all users edit /etc/bashrc as a superuser, but be aware that future OS X updates could potentially erase your modifications.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CLICOLOR</span>=<span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">ll</span>=<span style="color: #ff0000;">'ls -l'</span></pre></div></div>

<p>If you&#8217;d like to alter the ls defaults for coloration you can add one more line:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">LSCOLORS</span>=ExFxCxDxBxegedabagacad</pre></div></div>

<p>The incomprehensible value is a custom color setting defined by <a href="http://www.macgeekery.com/gspot/2007-01/interpreting_color_ls_output">these rules</a>.</p>
<p>For those who are new to the command line, ~/.profile means a file named &#8220;.profile&#8221; in your home directory.  You can create the text file in TextEdit, save as plain text, then rename it to .profile, but be sure to move it into your home directory first as the Finder hides files prefixed with &#8220;.&#8221; by default.</p>
]]></content:encoded>
			<wfw:commentRss>http://langui.sh/2009/01/01/color-terminal-in-os-x/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
