<?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>/kb &#187; cli</title>
	<atom:link href="http://grx.no/kb/tag/cli/feed/" rel="self" type="application/rss+xml" />
	<link>http://grx.no/kb</link>
	<description>personal knowledgebase</description>
	<lastBuildDate>Wed, 15 Jun 2011 07:07:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Open Finder for current directory from command line</title>
		<link>http://grx.no/kb/2009/01/09/open-finder-for-current-directory-from-command-line/</link>
		<comments>http://grx.no/kb/2009/01/09/open-finder-for-current-directory-from-command-line/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 07:41:22 +0000</pubDate>
		<dc:creator>Håvard Grimelid</dc:creator>
				<category><![CDATA[Shell]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[mac os]]></category>

		<guid isPermaLink="false">http://grx.no/kb/?p=91</guid>
		<description><![CDATA[I just learned how to open a Finder window directly from the command line. open . Yes, it&#8217;s actually that easy, and the open command is quite handy some times. This is from the open man page. The open command opens a file (or a directory or URL), just as if you had double-clicked the [...]]]></description>
			<content:encoded><![CDATA[<p>I just learned how to open a Finder window directly from the command line.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">open .</pre></div></div>

<p>Yes, it&#8217;s actually that easy, and the <em>open</em> command is quite handy some times. This is from the <em>open</em> man page.</p>
<blockquote><p>
The open command opens a file (or a directory or URL), just as if you had double-clicked the<br />
     file&#8217;s icon. If no application name is specified, the default application as determined via<br />
     LaunchServices is used to open the specified files.</p></blockquote>
<p>This means that you can actually open anything from the command line with the <em>open</em> command. Go ahead and try it out!</p>
]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2009/01/09/open-finder-for-current-directory-from-command-line/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Importing a MySQL dump file</title>
		<link>http://grx.no/kb/2009/01/06/importing-a-mysql-dump-file/</link>
		<comments>http://grx.no/kb/2009/01/06/importing-a-mysql-dump-file/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 17:58:32 +0000</pubDate>
		<dc:creator>Håvard Grimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://grx.no/kb/?p=88</guid>
		<description><![CDATA[mysql -h SERVER -uUSER -p DATABASE &#60; DUMPFILE]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-h</span> SERVER <span style="color: #660033;">-uUSER</span> <span style="color: #660033;">-p</span> DATABASE <span style="color: #000000; font-weight: bold;">&lt;</span> DUMPFILE</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2009/01/06/importing-a-mysql-dump-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Root partition free space</title>
		<link>http://grx.no/kb/2008/05/17/root-partition-free-space/</link>
		<comments>http://grx.no/kb/2008/05/17/root-partition-free-space/#comments</comments>
		<pubDate>Sat, 17 May 2008 17:21:15 +0000</pubDate>
		<dc:creator>Håvard Grimelid</dc:creator>
				<category><![CDATA[Shell]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cli]]></category>

		<guid isPermaLink="false">http://k.grx.no/?p=16</guid>
		<description><![CDATA[du -xh --max-depth=1 /]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-xh</span> <span style="color: #660033;">--max-depth</span>=<span style="color: #000000;">1</span>  <span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2008/05/17/root-partition-free-space/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On using find</title>
		<link>http://grx.no/kb/2008/05/15/on-using-find/</link>
		<comments>http://grx.no/kb/2008/05/15/on-using-find/#comments</comments>
		<pubDate>Thu, 15 May 2008 10:49:24 +0000</pubDate>
		<dc:creator>Håvard Grimelid</dc:creator>
				<category><![CDATA[Shell]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[searching]]></category>
		<category><![CDATA[xargs]]></category>

		<guid isPermaLink="false">http://k.grx.no/?p=14</guid>
		<description><![CDATA[find is an extremely powerful command. In order to leave the directory matching *DIRECTORY* out from your search for .txt-files: find . -path '*DIRECTORY*' -prune -o -iname '*.txt' -print If you&#8217;re using xargs together with find and xargs complains about file names with spaces, use: find . YOURFINDOPTIONSHERE -print0 &#124; xargs -0 rm -rf Finding [...]]]></description>
			<content:encoded><![CDATA[<p><code>find</code> is an extremely powerful command. In order to leave the directory matching <code>*DIRECTORY*</code> out from your search for <code>.txt</code>-files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-path</span> <span style="color: #ff0000;">'*DIRECTORY*'</span> <span style="color: #660033;">-prune</span> <span style="color: #660033;">-o</span> <span style="color: #660033;">-iname</span> <span style="color: #ff0000;">'*.txt'</span> <span style="color: #660033;">-print</span></pre></div></div>

<p>If you&#8217;re using <code>xargs</code> together with <code>find</code> and <code>xargs</code> complains about file names with spaces, use:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> . YOURFINDOPTIONSHERE <span style="color: #660033;">-print0</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">-0</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span></pre></div></div>

<p>Finding files larger than a certain limit:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-size</span> +200M <span style="color: #660033;">-print0</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #660033;">-0</span> <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-lh</span></pre></div></div>

<p>Deleting the complementary files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;*.mp3&quot;</span> <span style="color: #660033;">-delete</span></pre></div></div>

<p>Courtesy of <a href="http://hskaar.com/">HÃ¥kon</a>.</p>
<p>Please note that these commands pertains to the <em>BSD find</em> as on Mac OS 10.5.</p>
<p>UPDATE 20080517: Looking for file size<br />
UPDATE 20080602: Added deleting complement</p>
]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2008/05/15/on-using-find/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup a MySQL database with mysqldump</title>
		<link>http://grx.no/kb/2008/05/14/backup-a-mysql-database-with-mysqldump/</link>
		<comments>http://grx.no/kb/2008/05/14/backup-a-mysql-database-with-mysqldump/#comments</comments>
		<pubDate>Wed, 14 May 2008 16:29:50 +0000</pubDate>
		<dc:creator>Håvard Grimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqladmin]]></category>

		<guid isPermaLink="false">http://k.grx.no/?p=13</guid>
		<description><![CDATA[It&#8217;s very easy, but I always have to look it up. mysqldump --opt -u USERNAME -p -h HOST.HOST.COM DATABASE_TABLE &#62; DUMPFILE.sql]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s very easy, but I always have to look it up.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysqldump <span style="color: #660033;">--opt</span> <span style="color: #660033;">-u</span> USERNAME <span style="color: #660033;">-p</span> <span style="color: #660033;">-h</span> HOST.HOST.COM DATABASE_TABLE <span style="color: #000000; font-weight: bold;">&gt;</span> DUMPFILE.sql</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2008/05/14/backup-a-mysql-database-with-mysqldump/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

