<?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>AtomLabs</title> <atom:link href="http://atomlabs.net/feed/" rel="self" type="application/rss+xml" /><link>http://atomlabs.net</link> <description>Development at an atomic level</description> <lastBuildDate>Tue, 28 Dec 2010 03:37:10 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.5.1</generator> <item><title>Awk &#8211; Command line output less awkward</title><link>http://atomlabs.net/2010/12/awk-make-command-line-output-less-awkward/</link> <comments>http://atomlabs.net/2010/12/awk-make-command-line-output-less-awkward/#comments</comments> <pubDate>Sun, 26 Dec 2010 01:16:11 +0000</pubDate> <dc:creator>Webmaster</dc:creator> <category><![CDATA[CLI]]></category> <category><![CDATA[Linux]]></category> <guid
isPermaLink="false">http://atomlabs.net/?p=67</guid> <description><![CDATA[One very powerful tool in Linux is the (awk) text processing language. I always remember it because it makes long log files or command output, come back to you a little less (awk)ward. Yeah corny I know, but let&#8217;s look at what it can do and maybe you&#8217;ll agree: I want to find what&#8217;s happening [...]]]></description> <content:encoded><![CDATA[<p>One very powerful tool in Linux is the (awk) text processing language. I always remember it because it makes long log files or command output, come back to you a little less (awk)ward. Yeah corny I know, but let&#8217;s look at what it can do and maybe you&#8217;ll agree:</p><p><strong>I want to find what&#8217;s happening on my site:</strong></p><div
class="wp_codebox"><table><tr
id="p675"><td
class="code" id="p67code5"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>apache<span style="color: #000000; font-weight: bold;">/</span>domlogs<span style="color: #000000; font-weight: bold;">/</span>atomlabs.net
&nbsp;
173.205.126.94 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Dec<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span>:01:<span style="color: #000000;">19</span>:<span style="color: #000000;">57</span> -0500<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;POST /wp-cron.php?doing_wp_cron HTTP/1.0&quot;</span> <span style="color: #000000;">200</span> - <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;WordPress/3.0.3; http://atomlabs.net&quot;</span>
88.214.193.166 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Dec<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span>:01:<span style="color: #000000;">19</span>:<span style="color: #000000;">56</span> -0500<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET / HTTP/1.1&quot;</span> <span style="color: #000000;">200</span> <span style="color: #000000;">2715</span> <span style="color: #ff0000;">&quot;http://www.semrush.com/info/atomlabs.net&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3&quot;</span>
109.120.144.247 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Dec<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span>:01:<span style="color: #000000;">39</span>:04 -0500<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET /plugins/editors/tinymce/jscripts/tiny_mce/plugins/tinybrowser/tinybrowser.php?type=file&amp;folder= HTTP/1.0&quot;</span> <span style="color: #000000;">404</span> - <span style="color: #ff0000;">&quot;http://atomlabs.net/plugins/editors/tinymce/jscripts/tiny_mce/plugins/tinybrowser/tinybrowser.php?type=file&amp;folder=&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Win 9x 4.90)&quot;</span>
207.46.13.87 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Dec<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span>:01:<span style="color: #000000;">46</span>:00 -0500<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET /robots.txt HTTP/1.1&quot;</span> <span style="color: #000000;">301</span> <span style="color: #000000;">238</span> <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)&quot;</span>
207.46.13.87 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Dec<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span>:01:<span style="color: #000000;">46</span>:00 -0500<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET /robots.txt HTTP/1.1&quot;</span> <span style="color: #000000;">404</span> - <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)&quot;</span>
207.46.13.87 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Dec<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span>:01:<span style="color: #000000;">55</span>:<span style="color: #000000;">44</span> -0500<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET /page2.php HTTP/1.1&quot;</span> <span style="color: #000000;">301</span> <span style="color: #000000;">237</span> <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)&quot;</span>
88.214.193.166 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Dec<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span>:02:<span style="color: #000000;">10</span>:<span style="color: #000000;">24</span> -0500<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET / HTTP/1.1&quot;</span> <span style="color: #000000;">200</span> <span style="color: #000000;">3342</span> <span style="color: #ff0000;">&quot;http://www.semrush.com/info/atomlabs.net&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3&quot;</span>
209.85.238.86 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Dec<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span>:02:<span style="color: #000000;">33</span>:04 -0500<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET /dev/?feed=rss2 HTTP/1.1&quot;</span> <span style="color: #000000;">404</span> - <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;Feedfetcher-Google; (+http://www.google.com/feedfetcher.html; 1 subscribers; feed-id=17880273271851489999)&quot;</span>
66.249.72.100 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Dec<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span>:03:<span style="color: #000000;">14</span>:<span style="color: #000000;">50</span> -0500<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET /?p=23 HTTP/1.1&quot;</span> <span style="color: #000000;">200</span> <span style="color: #000000;">13019</span> <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)&quot;</span>
88.214.193.166 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Dec<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span>:03:<span style="color: #000000;">22</span>:<span style="color: #000000;">32</span> -0500<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET / HTTP/1.1&quot;</span> <span style="color: #000000;">200</span> <span style="color: #000000;">5884</span> <span style="color: #ff0000;">&quot;http://www.whorush.com/search/?q=atomlabs.net&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3&quot;</span>
88.214.193.166 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Dec<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span>:03:<span style="color: #000000;">24</span>:<span style="color: #000000;">48</span> -0500<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET / HTTP/1.1&quot;</span> <span style="color: #000000;">200</span> <span style="color: #000000;">5884</span> <span style="color: #ff0000;">&quot;http://www.whorush.com/search/?q=atomlabs.net&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3&quot;</span>
66.249.72.100 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Dec<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span>:04:09:<span style="color: #000000;">11</span> -0500<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET /dev HTTP/1.1&quot;</span> <span style="color: #000000;">404</span> - <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)&quot;</span></pre></td></tr></table></div><p>&nbsp;<br
/> I don&#8217;t know about you but that can become very cumbersome to look at, especially when you just want a specific chunk of information out of all of that mess. So this is where (awk) comes into play, in its simplest form we can use it to print information from a specific column of text.</p><p>By default (awk) is going to make the default delimiter a space, so if we had the text:</p><div
class="wp_codebox"><table><tr
id="p676"><td
class="code" id="p67code6"><pre class="bash" style="font-family:monospace;">66.249.72.100 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Dec<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span>:04:09:<span style="color: #000000;">11</span> -0500<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET /dev HTTP/1.1&quot;</span> <span style="color: #000000;">404</span> - <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/5.0</span></pre></td></tr></table></div><p>To only show the date this would be the 4th column of data, here is how (awk) would break it down:</p><div
class="wp_codebox"><table><tr
id="p677"><td
class="code" id="p67code7"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">$0</span> = 66.249.72.100 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Dec<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span>...<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #007800;">$1</span> = 66.249.72.100
<span style="color: #007800;">$2</span> = -
<span style="color: #007800;">$3</span> = -
<span style="color: #007800;">$4</span> = <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">25</span><span style="color: #000000; font-weight: bold;">/</span>Dec<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span>:04:09:<span style="color: #000000;">11</span>
<span style="color: #007800;">$5</span> = -0500<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></td></tr></table></div><p>&nbsp;<br
/> <strong>I want to find who&#8217;s visiting my site and what pages:</strong></p><div
class="wp_codebox"><table><tr
id="p678"><td
class="code" id="p67code8"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>apache<span style="color: #000000; font-weight: bold;">/</span>domlogs<span style="color: #000000; font-weight: bold;">/</span>atomlabs.net <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1 &quot; &quot; $7}'</span>
&nbsp;
173.205.126.94 <span style="color: #000000; font-weight: bold;">/</span>wp-cron.php?doing_wp_cron
88.214.193.166 <span style="color: #000000; font-weight: bold;">/</span>
109.120.144.247 <span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>editors<span style="color: #000000; font-weight: bold;">/</span>tinymce<span style="color: #000000; font-weight: bold;">/</span>jscripts<span style="color: #000000; font-weight: bold;">/</span>tiny_mce<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span>tinybrowser<span style="color: #000000; font-weight: bold;">/</span>tinybrowser.php?<span style="color: #007800;">type</span>=<span style="color: #c20cb9; font-weight: bold;">file</span><span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #007800;">folder</span>=
207.46.13.87 <span style="color: #000000; font-weight: bold;">/</span>robots.txt
207.46.13.87 <span style="color: #000000; font-weight: bold;">/</span>robots.txt
207.46.13.87 <span style="color: #000000; font-weight: bold;">/</span>page2.php
88.214.193.166 <span style="color: #000000; font-weight: bold;">/</span>
209.85.238.86 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>?<span style="color: #007800;">feed</span>=rss2
66.249.72.100 <span style="color: #000000; font-weight: bold;">/</span>?<span style="color: #007800;">p</span>=<span style="color: #000000;">23</span>
88.214.193.166 <span style="color: #000000; font-weight: bold;">/</span>
88.214.193.166 <span style="color: #000000; font-weight: bold;">/</span>
66.249.72.100 <span style="color: #000000; font-weight: bold;">/</span>dev</pre></td></tr></table></div><p>&nbsp;<br
/> You can pass multiple variables to (awk) like you&#8217;ve just seen above, you can also pass string data between quotes (&#8220;). I passed a space, that way the output would be the IP address, a space, then the file.</p> ]]></content:encoded> <wfw:commentRss>http://atomlabs.net/2010/12/awk-make-command-line-output-less-awkward/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Recall previous CLI arguments with ease</title><link>http://atomlabs.net/2010/12/recall-previous-arguments-with-ease/</link> <comments>http://atomlabs.net/2010/12/recall-previous-arguments-with-ease/#comments</comments> <pubDate>Fri, 24 Dec 2010 00:41:04 +0000</pubDate> <dc:creator>Webmaster</dc:creator> <category><![CDATA[CLI]]></category> <category><![CDATA[Linux]]></category> <guid
isPermaLink="false">http://atomlabs.net/?p=63</guid> <description><![CDATA[Have you ever been running various commands on the same file or folder, and get sick of having to re-type it in each time? One easy way to get around this is with the built in recall arguments feature built into Linux. Essentially you hit (Alt + # + .) where (#) is the number [...]]]></description> <content:encoded><![CDATA[<p>Have you ever been running various commands on the same file or folder, and get sick of having to re-type it in each time? One easy way to get around this is with the built in recall arguments feature built into Linux. Essentially you hit (Alt + # + .) where (#) is the number of argument you are recalling:</p><p><strong>Run a simple command with two arguments:</strong></p><div
class="wp_codebox"><table><tr
id="p6312"><td
class="code" id="p63code12"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">grep</span> user1<span style="color: #000000; font-weight: bold;">@</span>domain1.com <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>exim_mainlog</pre></td></tr></table></div><p><strong>Now after I type in the new command I want to run:</strong></p><div
class="wp_codebox"><table><tr
id="p6313"><td
class="code" id="p63code13"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">grep</span> user2<span style="color: #000000; font-weight: bold;">@</span>domain2.com</pre></td></tr></table></div><p><strong>I can recall the 2nd argument to grab my log path:</strong></p><div
class="wp_codebox"><table><tr
id="p6314"><td
class="code" id="p63code14"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">grep</span> user2<span style="color: #000000; font-weight: bold;">@</span>domain2.com <span style="color: #7a0874; font-weight: bold;">&#40;</span>Hold Alt + <span style="color: #000000;">2</span> + .<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #c20cb9; font-weight: bold;">grep</span> user2<span style="color: #000000; font-weight: bold;">@</span>domain2.com <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>exim_mainlog</pre></td></tr></table></div> ]]></content:encoded> <wfw:commentRss>http://atomlabs.net/2010/12/recall-previous-arguments-with-ease/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Exim &#8211; Mail queue commands</title><link>http://atomlabs.net/2010/12/exim-mail-queue-commands/</link> <comments>http://atomlabs.net/2010/12/exim-mail-queue-commands/#comments</comments> <pubDate>Thu, 23 Dec 2010 21:14:11 +0000</pubDate> <dc:creator>Webmaster</dc:creator> <category><![CDATA[Exim]]></category> <category><![CDATA[Linux]]></category> <guid
isPermaLink="false">http://atomlabs.net/dev/?p=61</guid> <description><![CDATA[exim -bp : Show summary of messages in queue exim -bpc : Show number of messages in queue -M : Force delivery -Mar : Add recipient -Meb : Edit message body -Mes : Edit sender -Mf : Freeze message -Mg : Give up (and bounce message) -Mmad : Mark all recipients as delivered -Mmd : [...]]]></description> <content:encoded><![CDATA[<p>exim -bp : Show summary of messages in queue<br
/> exim -bpc : Show number of messages in queue</p><p>-M : Force delivery<br
/> -Mar : Add recipient<br
/> -Meb : Edit message body<br
/> -Mes : Edit sender<br
/> -Mf : Freeze message<br
/> -Mg : Give up (and bounce message)<br
/> -Mmad : Mark all recipients as delivered<br
/> -Mmd : Mark recipient as delivered<br
/> -Mrm : Remove message (no bounce)<br
/> -Mt : Thaw message<br
/> -Mvb : View message body<br
/> -Mvh : View message header<br
/> -Mvl : View message log</p> ]]></content:encoded> <wfw:commentRss>http://atomlabs.net/2010/12/exim-mail-queue-commands/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Create file of certain size</title><link>http://atomlabs.net/2010/12/create-file-of-certain-size/</link> <comments>http://atomlabs.net/2010/12/create-file-of-certain-size/#comments</comments> <pubDate>Thu, 23 Dec 2010 21:09:26 +0000</pubDate> <dc:creator>Webmaster</dc:creator> <category><![CDATA[Uncategorized]]></category> <guid
isPermaLink="false">http://atomlabs.net/dev/?p=55</guid> <description><![CDATA[Wish you could create a test file for file-transfer testing? It&#8217;s easy with Linux&#8217;s (dd) command: Create 1MB file: dd if=/dev/zero of=1MB.txt bs=1024 count=1024 Create 50MB file: dd if=/dev/zero of=50MB.txt bs=1024 count=51200 Verify the sizes: ls -lh &#124; grep MB -rw-r--r-- 1 root root 1.0M Dec 23 16:06 1MB.txt -rw-r--r-- 1 root root 50M Dec [...]]]></description> <content:encoded><![CDATA[<p>Wish you could create a test file for file-transfer testing? It&#8217;s easy with Linux&#8217;s (dd) command:</p><p><strong>Create 1MB file:</strong></p><div
class="wp_codebox"><table><tr
id="p5518"><td
class="code" id="p55code18"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;">if</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>zero <span style="color: #007800;">of</span>=1MB.txt <span style="color: #007800;">bs</span>=<span style="color: #000000;">1024</span> <span style="color: #007800;">count</span>=<span style="color: #000000;">1024</span></pre></td></tr></table></div><p><strong>Create 50MB file:</strong></p><div
class="wp_codebox"><table><tr
id="p5519"><td
class="code" id="p55code19"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;">if</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>zero <span style="color: #007800;">of</span>=50MB.txt <span style="color: #007800;">bs</span>=<span style="color: #000000;">1024</span> <span style="color: #007800;">count</span>=<span style="color: #000000;">51200</span></pre></td></tr></table></div><p><strong>Verify the sizes:</strong></p><div
class="wp_codebox"><table><tr
id="p5520"><td
class="code" id="p55code20"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-lh</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> MB
<span style="color: #660033;">-rw-r--r--</span>  <span style="color: #000000;">1</span> root root 1.0M Dec <span style="color: #000000;">23</span> <span style="color: #000000;">16</span>:06 1MB.txt
<span style="color: #660033;">-rw-r--r--</span>  <span style="color: #000000;">1</span> root root  50M Dec <span style="color: #000000;">23</span> <span style="color: #000000;">16</span>:06 50MB.txt</pre></td></tr></table></div> ]]></content:encoded> <wfw:commentRss>http://atomlabs.net/2010/12/create-file-of-certain-size/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Convert text to upper-case or lower-case</title><link>http://atomlabs.net/2010/12/linux-convert-text-to-upper-case-or-lower-case/</link> <comments>http://atomlabs.net/2010/12/linux-convert-text-to-upper-case-or-lower-case/#comments</comments> <pubDate>Thu, 23 Dec 2010 16:26:24 +0000</pubDate> <dc:creator>Webmaster</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Scripting]]></category> <guid
isPermaLink="false">http://atomlabs.net/dev/?p=32</guid> <description><![CDATA[There are more than a couple of ways to convert a string with upper-case letters to lower-case and vice-versa in Linux, here are my favorite two: awk echo &#34;TEXT WITH CAPS-LOCK ON&#34; &#124; awk '{print tolower($0)}' text with caps-lock on &#160; echo &#34;text with caps-lock off&#34; &#124; awk '{print toupper($0)}' TEXT WITH CAPS-LOCK OFF dd [...]]]></description> <content:encoded><![CDATA[<p>There are more than a couple of ways to convert a string with upper-case letters to lower-case and vice-versa in Linux, here are my favorite two:</p><p><strong>awk</strong></p><div
class="wp_codebox"><table><tr
id="p3223"><td
class="code" id="p32code23"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;TEXT WITH CAPS-LOCK ON&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print tolower($0)}'</span>
text with caps-lock on
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;text with caps-lock off&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print toupper($0)}'</span>
TEXT WITH CAPS-LOCK OFF</pre></td></tr></table></div><p><strong>dd</strong></p><div
class="wp_codebox"><table><tr
id="p3224"><td
class="code" id="p32code24"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;TEXT WITH CAPS-LOCK ON&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> upperText; <span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;">if</span>=upperText <span style="color: #007800;">of</span>=lowerText <span style="color: #007800;">conv</span>=lcase; <span style="color: #c20cb9; font-weight: bold;">cat</span> lowerText
<span style="color: #000000;">0</span>+<span style="color: #000000;">1</span> records <span style="color: #000000; font-weight: bold;">in</span>
<span style="color: #000000;">0</span>+<span style="color: #000000;">1</span> records out
<span style="color: #000000;">23</span> bytes <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">23</span> B<span style="color: #7a0874; font-weight: bold;">&#41;</span> copied, 2.1e-05 seconds, <span style="color: #000000;">1.1</span> MB<span style="color: #000000; font-weight: bold;">/</span>s
text with caps-lock on
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;text with caps-lock off&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> lowerText; <span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;">if</span>=lowerText <span style="color: #007800;">of</span>=upperText <span style="color: #007800;">conv</span>=ucase; <span style="color: #c20cb9; font-weight: bold;">cat</span> upperText
<span style="color: #000000;">0</span>+<span style="color: #000000;">1</span> records <span style="color: #000000; font-weight: bold;">in</span>
<span style="color: #000000;">0</span>+<span style="color: #000000;">1</span> records out
<span style="color: #000000;">24</span> bytes <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">24</span> B<span style="color: #7a0874; font-weight: bold;">&#41;</span> copied, 3.4e-05 seconds, <span style="color: #000000;">706</span> kB<span style="color: #000000; font-weight: bold;">/</span>s
TEXT WITH CAPS-LOCK OFF</pre></td></tr></table></div> ]]></content:encoded> <wfw:commentRss>http://atomlabs.net/2010/12/linux-convert-text-to-upper-case-or-lower-case/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Find the difference between two files</title><link>http://atomlabs.net/2010/12/linux-diff-sdiff/</link> <comments>http://atomlabs.net/2010/12/linux-diff-sdiff/#comments</comments> <pubDate>Sat, 18 Dec 2010 14:10:00 +0000</pubDate> <dc:creator>Webmaster</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[command]]></category> <guid
isPermaLink="false">http://atomlabs.net/dev/?p=3</guid> <description><![CDATA[Using the (diff) command you can find out the difference between two files, (sdiff) allows for you to see both files at once to find the difference. echo &#34;ABC&#34; &#62; a echo &#34;ABCD&#34; &#62; b diff a b 1c1 &#60; ABC --- &#62; ABCD sdiff a b ABC &#124; ABCD]]></description> <content:encoded><![CDATA[<p>Using the (diff) command you can find out the difference between two files, (sdiff) allows for you to see both files at once to find the difference.</p><div
class="wp_codebox"><table><tr
id="p326"><td
class="code" id="p3code26"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;ABC&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> a
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;ABCD&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> b
<span style="color: #c20cb9; font-weight: bold;">diff</span> a b
1c1
<span style="color: #000000; font-weight: bold;">&lt;</span> ABC
<span style="color: #660033;">---</span>
<span style="color: #000000; font-weight: bold;">&gt;</span> ABCD
sdiff a b
ABC                                                           <span style="color: #000000; font-weight: bold;">|</span> ABCD</pre></td></tr></table></div> ]]></content:encoded> <wfw:commentRss>http://atomlabs.net/2010/12/linux-diff-sdiff/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>If statements</title><link>http://atomlabs.net/2010/12/linux-if-loops/</link> <comments>http://atomlabs.net/2010/12/linux-if-loops/#comments</comments> <pubDate>Sat, 11 Dec 2010 03:54:31 +0000</pubDate> <dc:creator>Webmaster</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Scripting]]></category> <guid
isPermaLink="false">http://atomlabs.net/dev/?p=23</guid> <description><![CDATA[In Linux just like with most scripting languages you can use if statements to allow for step-by-step processing through a set of rules. Let&#8217;s say you wanted to have a simple script to handle clock-ins for you employees: #!/bin/sh &#160; echo &#34;Enter your employee ID:&#34; read employeeID &#160; echo &#34;in - Clock in&#34; echo &#34;out [...]]]></description> <content:encoded><![CDATA[<p>In Linux just like with most scripting languages you can use if statements to allow for step-by-step processing through a set of rules. Let&#8217;s say you wanted to have a simple script to handle clock-ins for you employees:</p><div
class="wp_codebox"><table><tr
id="p2328"><td
class="code" id="p23code28"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Enter your employee ID:&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">read</span> employeeID
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;in - Clock in&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;out - Clock out&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">read</span> clockStatus
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$clockStatus</span> = <span style="color: #ff0000;">&quot;in&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$employeeID</span><span style="color: #ff0000;">&quot;_timeclock&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$employeeID</span> logged in&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$employeeID</span><span style="color: #ff0000;">&quot;_timeclock&quot;</span>
<span style="color: #000000; font-weight: bold;">else</span>
        <span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$employeeID</span><span style="color: #ff0000;">&quot;_timeclock&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$employeeID</span> logged out&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$employeeID</span><span style="color: #ff0000;">&quot;_timeclock&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></td></tr></table></div> ]]></content:encoded> <wfw:commentRss>http://atomlabs.net/2010/12/linux-if-loops/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>For loops</title><link>http://atomlabs.net/2010/12/linux-for-loops/</link> <comments>http://atomlabs.net/2010/12/linux-for-loops/#comments</comments> <pubDate>Sat, 11 Dec 2010 03:42:23 +0000</pubDate> <dc:creator>Webmaster</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Scripting]]></category> <guid
isPermaLink="false">http://atomlabs.net/dev/?p=17</guid> <description><![CDATA[for variable in list; do echo $variable; done list for variable in a b c d; do echo $variable; done a b c d for variable in a b c d; do echo $variable; done &#62; list for variable in $&#40;cat list&#41;; do echo $variable; done a b c d]]></description> <content:encoded><![CDATA[<div
class="wp_codebox"><table><tr
id="p1732"><td
class="code" id="p17code32"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> variable <span style="color: #000000; font-weight: bold;">in</span> list; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$variable</span>; <span style="color: #000000; font-weight: bold;">done</span>
list</pre></td></tr></table></div><div
class="wp_codebox"><table><tr
id="p1733"><td
class="code" id="p17code33"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> variable <span style="color: #000000; font-weight: bold;">in</span> a b c d; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$variable</span>; <span style="color: #000000; font-weight: bold;">done</span>
a
b
c
d</pre></td></tr></table></div><div
class="wp_codebox"><table><tr
id="p1734"><td
class="code" id="p17code34"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> variable <span style="color: #000000; font-weight: bold;">in</span> a b c d; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$variable</span>; <span style="color: #000000; font-weight: bold;">done</span> <span style="color: #000000; font-weight: bold;">&gt;</span> list
<span style="color: #000000; font-weight: bold;">for</span> variable <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">cat</span> list<span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$variable</span>; <span style="color: #000000; font-weight: bold;">done</span>
a
b
c
d</pre></td></tr></table></div> ]]></content:encoded> <wfw:commentRss>http://atomlabs.net/2010/12/linux-for-loops/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Dynamic page generated in 0.551 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2013-04-26 07:18:12 -->
