<?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>Yet Another Linux Blog &#187; shell</title>
	<atom:link href="http://linux-blog.org/tag/shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://linux-blog.org</link>
	<description>Open Source, Open Blog</description>
	<lastBuildDate>Fri, 03 Feb 2012 14:33:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Finding Files with locate</title>
		<link>http://linux-blog.org/finding-files-with-locate/</link>
		<comments>http://linux-blog.org/finding-files-with-locate/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 16:52:06 +0000</pubDate>
		<dc:creator>devnet</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://linux-blog.org/?p=1666</guid>
		<description><![CDATA[Many Linux users use the &#8216;find&#8217; utility when searching for files using the command line on their system. They&#8217;ll do a simple: Really though, the power of find isn&#8217;t just in finding names of files but rather specific details about those files. For example, if you wanted to find files which are writable by both [...]]]></description>
			<content:encoded><![CDATA[<p>Many Linux users use the &#8216;find&#8217; utility when searching for files using the command line on their system.  They&#8217;ll do a simple:</p>
<pre class="brush: plain; title: ; notranslate">find / -name 'pattern'</pre>
<p>Really though, the power of find isn&#8217;t just in finding names of files but rather specific details about those files.  For example, if you wanted to find files which are writable by both their owner and their group:</p>
<pre class="brush: plain; title: ; notranslate">find / -perm -444 -perm /222 ! -perm /111</pre>
<p>or perhaps find any file that&#8217;s been altered in your Download directory in the past 24 hours:</p>
<pre class="brush: plain; title: ; notranslate">find /home/user/Downloads/ -mtime 0</pre>
<p>As you can see, the find command is very versatile and can be used to find an array of different attributes of files.  There are times though where I&#8217;m just looking for something and I don&#8217;t want to have to wait for the command to scan the entire directory tree in order to track it down.  That&#8217;s where locate comes in with quick and simple results.</p>
<h3>Using the Locate Command</h3>
<p>Using the locate command can only be accomplished if you install the mlocate package.  Most major distributions have this available.  If not, <a title="mlocate homepage" href="http://carolina.mff.cuni.cz/~trmac/blog/mlocate/" target="_blank">head over to the mlocate homepage</a> and install manually.  Once that is accomplished, you&#8217;ll need to manually run a command to index your filesystem with it&#8230;otherwise, you&#8217;ll have to wait for the command to run automatically as it registers with cron to do so on a system level.  Open an terminal and change to your root user, then execute the following:</p>
<pre class="brush: plain; title: ; notranslate">updatedb &amp;</pre>
<p>This updates the mlocate database that indexes your files and forks it to the background (the &#8216;&amp;&#8217; forks it to the background).  You can now logout of the terminal as root and the process will quietly work in the background.</p>
<p>After the command completes, using mlocate is as easy as using the locate command:</p>
<pre class="brush: plain; title: ; notranslate">locate firefox | less</pre>
<p>The command above will look for all files with firefox in the name and pipe the command through less so you can use the spacebar or enter key to scroll the file buffer.  Of course, the reason we pipe it through less is because any file that resides in the &#8216;firefox&#8217; directory will be reported in the output.  While this tool isn&#8217;t as granular as the find command, it is a quick way to track down paths, directories, and files you know should exist.  Since the data is indexed using the updatedb command (by cron) the results are very quick and the command does not have to scan through the filesystem to return the results.</p>
<p>There are plenty more advanced options via flags (such as following symbolic links, making search term case sensitive, and even using regexp).  See the man page for details on how each of these options work.  Play around with locate and see what you can do!  It&#8217;s a powerful and quick search command!</p>
<p><a href="http://linux-blog.org/finding-files-with-locate/" rel="bookmark">Finding Files with locate</a> originally appeared on <a href="http://linux-blog.org">Yet Another Linux Blog</a> on September 7, 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://linux-blog.org/finding-files-with-locate/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Convert PNG to GIF via Command Line</title>
		<link>http://linux-blog.org/convert-png-to-gif-via-command-line/</link>
		<comments>http://linux-blog.org/convert-png-to-gif-via-command-line/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 18:24:03 +0000</pubDate>
		<dc:creator>devnet</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://linux-blog.org/?p=1260</guid>
		<description><![CDATA[I installed a bare bones Arch Linux system today and took a screenshot.  With no graphics utilities installed, I needed a way to convert a PNG to a GIF for a Simple Machines forum template thumbnail.  I figured I&#8217;d use a command line utility to help me and ImageMagick is installed by default on most [...]]]></description>
			<content:encoded><![CDATA[<p>I installed a bare bones Arch Linux system today and took a screenshot.  With no graphics utilities installed, I needed a way to convert a PNG to a GIF for a Simple Machines forum template thumbnail.  I figured I&#8217;d use a command line utility to help me and ImageMagick is installed by default on most distributions.  A quick read through the ImageMagick manpage and I found the <em>convert</em> command and thought I&#8217;d share it with everyone.  Use convert in the following fashion:  <strong>convert [input-options] input-file [output-options] output-file</strong></p>
<pre class="brush: plain; title: ; notranslate">convert SMFPress.png -channel Alpha -threshold 80% -resize 120x120 thumbnail.gif</pre>
<p>This did a quick, same-size conversion with little loss for me to display the thumbnail online.  For more information on the options I used and other options that I didn&#8217;t use, take a peek at the<a title="ImageMagick Help Convert" href="http://www.imagemagick.org/script/convert.php" target="_blank"> ImageMagick Online Help Page for convert.</a></p>
<p><a href="http://linux-blog.org/convert-png-to-gif-via-command-line/" rel="bookmark">Convert PNG to GIF via Command Line</a> originally appeared on <a href="http://linux-blog.org">Yet Another Linux Blog</a> on November 6, 2009.</p>
]]></content:encoded>
			<wfw:commentRss>http://linux-blog.org/convert-png-to-gif-via-command-line/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Read &amp; Display Single Line of a File</title>
		<link>http://linux-blog.org/read-display-single-line-of-a-file/</link>
		<comments>http://linux-blog.org/read-display-single-line-of-a-file/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 21:38:49 +0000</pubDate>
		<dc:creator>devnet</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Asides]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://linux-blog.org/?p=780</guid>
		<description><![CDATA[Sometimes when I&#8217;m troubleshooting a PHP error and a function is called in the debugger that gives me a line number of a file to look at, I want to know what that line says without opening up the file.  Using the command line, you can accomplish this in the following way: head -n 96 [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes when I&#8217;m troubleshooting a PHP error and a function is called in the debugger that gives me a line number of a file to look at, I want to know what that line says without opening up the file.  Using the command line, you can accomplish this in the following way:</p>
<pre>head -n 96 filename.php | tail -n 1</pre>
<p>This allows you to quickly display the 96th line of filename.php.  Hope this helps someone like it has me.</p>
<p><a href="http://linux-blog.org/read-display-single-line-of-a-file/" rel="bookmark">Read &#038; Display Single Line of a File</a> originally appeared on <a href="http://linux-blog.org">Yet Another Linux Blog</a> on November 18, 2008.</p>
]]></content:encoded>
			<wfw:commentRss>http://linux-blog.org/read-display-single-line-of-a-file/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

