<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" gd:etag="W/&quot;A04ERHc_eSp7ImA9WhRUFUQ.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759</id><updated>2012-01-26T09:45:05.941-08:00</updated><title>Linux Commando</title><subtitle type="html">This blog is about the Linux Command Line Interface (CLI), with an occasional foray into graphical user interface territory.

Instead of just giving you information like some man page, I hope to illustrate each command in real-life scenarios.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>82</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/linuxcommando" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="linuxcommando" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">linuxcommando</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;CUIESH8_fyp7ImA9WxFSEE8.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-991849414647624152</id><published>2010-04-11T14:42:00.000-07:00</published><updated>2010-04-11T15:05:09.147-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-11T15:05:09.147-07:00</app:edited><title>How to insert a file at a specific line and column</title><content type="html">&lt;p&gt;My objective is to insert the complete contents of a text file at a specific row and column of another text file.&lt;br /&gt;&lt;p&gt;If we are merely concerned with inserting after a specific line, it can be readily achieved with a number of Linux tools. For example, to insert file1.txt after the second line of file2.txt, any of the following commands will do:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;$ sed -i '2r file1.txt' file2.txt&lt;/li&gt;&lt;br /&gt;&lt;li&gt;$ awk '{print} NR==2 {while (getline &lt; "file1.txt") print}' file2.txt&lt;br&gt;&lt;br /&gt;Unlike the previous &lt;span style="font-style:italic;"&gt;sed&lt;/span&gt; command which modifies file2 in-line, the above &lt;span style="font-style:italic;"&gt;awk&lt;/span&gt; command writes the desired output to standard output only.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;$ emacs -batch +3 file2.txt --insert file1.txt -f save-buffer -kill&lt;br&gt;&lt;br /&gt;This uses the batch capability of the &lt;span style="font-style:italic;"&gt;emacs&lt;/span&gt; text editor.  The command opens file2 at line 3, inserts file1, saves and then exits. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;$ vi +2 file2.txt &lt;&lt; DELIM &lt;br /&gt;&gt; :r file1.txt&lt;br /&gt;&gt; :wq &lt;br /&gt;&gt; DELIM&lt;br /&gt;Vim: Warning: Input is not from a terminal&lt;br&gt;&lt;br /&gt;Note that after you enter the first line ("vi +2 ..."), you will be prompted for more input. At that time, you enter the next three lines (:r, :wq, DELIM) &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;While Linux has many utilities to manipulate text (&lt;span style="font-style:italic;"&gt;sed&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;perl&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;awk&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;cut&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;python&lt;/span&gt;), the easiest way I can think of to accomplish my objective to insert at a target line and column is using &lt;span style="font-style:italic;"&gt;emacs&lt;/span&gt;.&lt;br&gt;&lt;br /&gt;$ emacs -batch -Q +2:3 file2.txt --insert file1.txt -f save-buffer -kill 2&gt;/dev/null&lt;br /&gt;&lt;p&gt;The key is &lt;span style="font-style:italic;"&gt;+2:3&lt;/span&gt; which directs the editor to open the file at line 2 column 3.   &lt;br /&gt;&lt;p&gt;Two other components in the above &lt;span style="font-style:italic;"&gt;emacs&lt;/span&gt; command warrant some explanation.  First, &lt;span style="font-style:italic;"&gt;-Q&lt;/span&gt; means quick startup.  Quick, because &lt;span style="font-style:italic;"&gt;emacs&lt;/span&gt; won't load any init file, or any splash file.  Second, the last part of the command pipes any standard error output from the &lt;span style="font-style:italic;"&gt;emacs&lt;/span&gt; editor to the null device.&lt;br /&gt;&lt;p&gt;I don't doubt that &lt;span style="font-style:italic;"&gt;sed&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;awk&lt;/span&gt; or &lt;span style="font-style:italic;"&gt;perl&lt;/span&gt; can do the job.  If you have a simple solution, please share with us via the comment feature of this web page.  Many thanks.&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2010/04/how-to-insert-file-at-specific-line-and.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2010/04/how-to-insert-file-at-specific-line-and.html&amp;title=How%20to%20insert%20a%20file%20at%20a%20specific%20line%20and%20column"&gt;&lt;img border=0 src="http://bp0.blogger.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-991849414647624152?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/c6tKDR0OJg-rdMHv_MNvaY1ve9I/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/c6tKDR0OJg-rdMHv_MNvaY1ve9I/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/c6tKDR0OJg-rdMHv_MNvaY1ve9I/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/c6tKDR0OJg-rdMHv_MNvaY1ve9I/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/991849414647624152/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=991849414647624152&amp;isPopup=true" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/991849414647624152?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/991849414647624152?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2010/04/how-to-insert-file-at-specific-line-and.html" title="How to insert a file at a specific line and column" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://bp0.blogger.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>4</thr:total></entry><entry gd:etag="W/&quot;DEYERnwyeyp7ImA9WxNbEks.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-6752733815572013359</id><published>2009-11-14T22:20:00.000-08:00</published><updated>2009-11-14T22:21:47.293-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-14T22:21:47.293-08:00</app:edited><title>Fun with Date Arithmetic</title><content type="html">We all know that the &lt;span style="font-style:italic;"&gt;date&lt;/span&gt; command tells you the current time. Occasionally, you use the same command to set the time.  That however becomes rarer these days with the advent of the &lt;a href="http://www.ntp.org/" &gt;ntp&lt;/a&gt; service that automatically synchronizes your computer's time with a super accurate public time server of your choice.&lt;br /&gt;&lt;br /&gt;Various implementations of the &lt;span style="font-style:italic;"&gt;date&lt;/span&gt; command are in use today.   This article discusses the &lt;span style="font-style:italic;"&gt;date&lt;/span&gt; command of the GNU coreutils package.&lt;br /&gt;&lt;br /&gt;By default, the &lt;span style="font-style:italic;"&gt;date&lt;/span&gt; command tells you the time now. The &lt;span style="font-style:italic;"&gt;date&lt;/span&gt; command also lets you do some basic date addition and subtraction. This is achieved by specifying the -d option which displays a time that you entered as a parameter rather than now.&lt;br /&gt;&lt;br /&gt;How many times have you asked yourself what the calendar date is N days ago?   Just the other day, I needed to find out the precise date of 30 days ago in order to locate the proper log file.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$ date&lt;br /&gt;Sat Nov 14 17:54:51 PST 2009&lt;br /&gt;$ date -d -30days&lt;br /&gt;Thu Oct 15 18:54:56 PDT 2009&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Just like you use subtraction to calculate a back date, you use addition to calculate a forward date.  The example below displays the date 30 days from today.&lt;br /&gt;&lt;pre&gt;$ date -d +30days&lt;br /&gt;Thu Oct 15 18:54:56 PDT 2009&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Besides days as the unit, you can also manipulate years, months, hours, minutes, and seconds.&lt;br /&gt;&lt;pre&gt;peter@tiger:~$ date -d +2months&lt;br /&gt;Thu Jan 14 18:48:43 PST 2010&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can combine them together like this:&lt;br /&gt;&lt;pre&gt;$ date -d +2months17days&lt;br /&gt;Sun Jan 31 18:49:45 PST 2010&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note that all the above are calculated relative to today's date.    What about queries like 10 days tomorrow?&lt;br /&gt;&lt;pre&gt;$ date -d tomorrow+10days&lt;br /&gt;date -d tomorrow+10days&lt;br /&gt;Wed Nov 25 18:52:03 PST 2009&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;10 days yesterday?&lt;br /&gt;&lt;pre&gt;$ date -d yesterday-10days&lt;br /&gt;Tue Nov  3 18:53:07 PST 2009&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can also perform your arithmetic relative to a specific day, say January 21, 2010.&lt;br /&gt;&lt;pre&gt;$ date -d '2010-01-21 + 2 weeks 3 days'&lt;br /&gt;Sun Feb  7 00:00:00 PST 2010&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Lastly, the &lt;span style="font-style:italic;"&gt;date&lt;/span&gt; command also recognizes the day of weeks (Sunday, Monday, ...) and the 2 keywords "last" and "next".&lt;br /&gt;&lt;pre&gt;$ date -d 'next tuesday + 1 day'&lt;br /&gt;Wed Nov 18 00:00:00 PST 2009&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I hope you have fun with this versatile tool.&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2009/11/fun-with-date-arithmetic.html';&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2009/11/fun-with-date-arithmetic.html&amp;title=Fun%20with%20Date%20Arithmetic"&gt;&lt;img border=0 src="http://bp0.blogger.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-6752733815572013359?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/5PWJIpW2iNcISIOkYPpaiVzCxd4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5PWJIpW2iNcISIOkYPpaiVzCxd4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/5PWJIpW2iNcISIOkYPpaiVzCxd4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/5PWJIpW2iNcISIOkYPpaiVzCxd4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/6752733815572013359/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=6752733815572013359&amp;isPopup=true" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/6752733815572013359?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/6752733815572013359?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2009/11/fun-with-date-arithmetic.html" title="Fun with Date Arithmetic" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://bp0.blogger.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>5</thr:total></entry><entry gd:etag="W/&quot;D0cARXYzeCp7ImA9WxJbFks.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-3099186438937921628</id><published>2009-07-17T18:41:00.000-07:00</published><updated>2009-07-26T20:24:04.880-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-26T20:24:04.880-07:00</app:edited><title>How to move print jobs from one printer queue to another</title><content type="html">In the olden days, an entire office department shared one printer.  At home, an entire household shared one printer.  Nowadays, I have 2 printers at home (1 HP LaserJet and 1 Samsung Monochrome Laser printer).&lt;br /&gt;&lt;br /&gt;With access to multiple printers come new opportunities and challenges. One of those opportunities is that if one printer goes down for whatever reason, you can route your print jobs to the surviving one. One challenge is that you need to manage multiple printer queues. With more than 1 printer, I often find myself printing to the wrong one.  How do you route print jobs from 1 printer to another when the need arises?&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Job Submitted to Wrong Printer&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;Let's first consider this situation: you just submit your print job to the default printer(&lt;span style="font-style:italic;"&gt;mySamsung&lt;/span&gt;), but you realize after the fact that it is the wrong printer.  &lt;br /&gt;&lt;br /&gt;First, you should find out the print job number.  Run the familiar &lt;span style="font-style:italic;"&gt;lpq&lt;/span&gt; command.&lt;br /&gt;&lt;pre&gt;$ lpq -P mySamsung&lt;br /&gt;mySamsung is ready and printing&lt;br /&gt;Rank    Owner   Job     File(s)              Total Size&lt;br /&gt;active  peter   706     (i)                  100352 bytes&lt;br /&gt;1st     peter   707     MoviesReview         228352 bytes&lt;br /&gt;$&lt;/pre&gt;&lt;br /&gt;Note that given &lt;span style="font-style:italic;"&gt;mySamsung&lt;/span&gt; is my default printer, I don't really need to explicitly specify the printer: &lt;span style="font-style:italic;"&gt;lpq&lt;/span&gt; without any argument will do just fine.&lt;br /&gt;&lt;br /&gt;Say job 707 is the one you want to move to the other printer.&lt;br /&gt;&lt;br /&gt;The Linux command to do the actual migration is &lt;span style="font-style:italic;"&gt;lpmove&lt;/span&gt;.  Note that you need to run the command as &lt;span style="font-style:italic;"&gt;root.&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$ sudo lpmove mySamsung-707 myHP&lt;br /&gt;$ lpq -P myHP&lt;br /&gt;myHP is ready&lt;br /&gt;Rank    Owner   Job     File(s)                 Total Size&lt;br /&gt;active  peter   707     MoviesReview            228352  bytes&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note how I specified the job number to &lt;span style="font-style:italic;"&gt;lpmove.&lt;/span&gt;   The format is the printer name(&lt;span style="font-style:italic;"&gt;mySamsung&lt;/span&gt;) and a dash(-), followed by the job number (707).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Printer Down&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;Suppose &lt;span style="font-style:italic;"&gt;mySamsung&lt;/span&gt; is out of service for whatever reason.  Then, you need to move &lt;span style="font-weight:bold;"&gt;all&lt;/span&gt; print jobs from &lt;span style="font-style:italic;"&gt;mySamsung&lt;/span&gt; to &lt;span style="font-style:italic;"&gt;myPrinter.&lt;/span&gt; &lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$ sudo lpmove mySamsung myHP&lt;br /&gt;$ &lt;/pre&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2009/07/how-to-move-print-jobs-from-one-printer.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2009/07/how-to-move-print-jobs-from-one-printer.html&amp;title=how-to-move-print-jobs-from-one-printer"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-3099186438937921628?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/XAYFXXwJ594mU3_mmKY9pnSndw0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/XAYFXXwJ594mU3_mmKY9pnSndw0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/XAYFXXwJ594mU3_mmKY9pnSndw0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/XAYFXXwJ594mU3_mmKY9pnSndw0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/3099186438937921628/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=3099186438937921628&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/3099186438937921628?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/3099186438937921628?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2009/07/how-to-move-print-jobs-from-one-printer.html" title="How to move print jobs from one printer queue to another" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CUINR3kyfyp7ImA9WxJUEEQ.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-5655786115742334154</id><published>2009-07-02T16:30:00.000-07:00</published><updated>2009-07-08T15:53:16.797-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-08T15:53:16.797-07:00</app:edited><title>Search and replace line feeds using emacs</title><content type="html">As an avid emacs user for a decade plus, I am a little embarrassed to confess that I did not know for the longest time how to search for or replace line feed (newline) characters. &lt;br /&gt;&lt;br /&gt;If you are only searching for run-of-the-mill ASCII strings such as &lt;em&gt;abc&lt;/em&gt;, you just type &lt;em&gt;C-s&lt;/em&gt; (control-S), and then the characters, and hit &lt;em&gt;return&lt;/em&gt;. &lt;br /&gt;&lt;br /&gt;Unfortunately, if your search string includes a line feed character, e.g., &lt;em&gt;abc&lt;/em&gt; followed by a newline, I have some good news and some bad news for you.&lt;br /&gt;&lt;br /&gt;The good news is that you use the same shortcut (&lt;em&gt;C-s&lt;/em&gt;) just like you would normally to search for anything else. &lt;br /&gt;&lt;br /&gt;The bad news is that the representation of what emacs understands to be a newline is not that intuitive ... even to geeks. Instead of something like &lt;em&gt;\n&lt;/em&gt; which may mean something to developers, you need to enter &lt;em&gt;C-q C-j&lt;/em&gt; (Control-Q, Control-J) for each line feed in the search string.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;C-q&lt;/em&gt; is the shortcut for the &lt;em&gt;quoted-insert&lt;/em&gt; command. The character you type immediately after &lt;em&gt;C-q&lt;/em&gt; is escaped, i.e., its normal function is suppressed. &lt;em&gt;C-j &lt;/em&gt;is the line feed character. Why the letter j, you ask? It turns out that the line feed character is represented by the decimal value 10 in the &lt;a href="http://www.asciitable.com/"&gt;ASCII table&lt;/a&gt;, and j is the 10th letter in the English alphabet. Similarly, if you are searching for the &lt;em&gt;Tab &lt;/em&gt;instead of the newline character, use &lt;em&gt;C-q C-i&lt;/em&gt; to denote the &lt;em&gt;Tab&lt;/em&gt; character. &lt;br /&gt;&lt;br /&gt;If you want to &lt;strong&gt;replace&lt;/strong&gt; occurrences of a string that includes one or more line feeds, the method is similar. Use the usual command &lt;em&gt;replace-string&lt;/em&gt; or &lt;em&gt;query-replace&lt;/em&gt;(&lt;em&gt;M-%&lt;/em&gt;). Enter &lt;em&gt;C-q C-j&lt;/em&gt; where you would expect to type the new line. &lt;br /&gt;&lt;pre&gt;M-x replace-string (Hit return) abcC-qC-j (Hit return) def (Hit return)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2009/07/search-and-replace-line-feeds-using.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2009/07/search-and-replace-line-feeds-using.html&amp;title=Search%20and%20replace%20line%20feeds%20using%20emacs"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-5655786115742334154?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8vVdoQnOw3XouaHaw6QAa0Nk90k/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8vVdoQnOw3XouaHaw6QAa0Nk90k/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8vVdoQnOw3XouaHaw6QAa0Nk90k/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8vVdoQnOw3XouaHaw6QAa0Nk90k/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/5655786115742334154/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=5655786115742334154&amp;isPopup=true" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/5655786115742334154?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/5655786115742334154?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2009/07/search-and-replace-line-feeds-using.html" title="Search and replace line feeds using emacs" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>3</thr:total></entry><entry gd:etag="W/&quot;C0cER34ycCp7ImA9WxJXFE4.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-7350097472364037502</id><published>2009-06-07T17:17:00.000-07:00</published><updated>2009-06-07T20:16:46.098-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-07T20:16:46.098-07:00</app:edited><title>loook: A light-weight text search tool for OpenOffice documents</title><content type="html">If you are happily running a desktop search tool such as &lt;a href="http://projects.gnome.org/tracker/"&gt;Tracker&lt;/a&gt; or &lt;a href="http://beagle-project.org/Main_Page"&gt;Beagle&lt;/a&gt;, read no further.  You already have the search tool you need to search OpenOffice files and more.  These desktop search tools build indexes to improve search performance, and are in general quite scalable.  Yet, a desktop search tool may be an overkill if you are just searching for certain text string in a directory containing OpenOffice files.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.danielnaber.de/loook"&gt;loook&lt;/a&gt; is a no-frill, yet very functional text search tool for OpenOffice files. Unlike the aforementioned desktop search engines, it does not build an index of your OpenOffice files. Despite the lack of an index, searching a hierarchy of 75 OpenOffice documents only took a couple of seconds.  That is good enough for my use.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;loook&lt;/span&gt; composes of a single zipped-up python script which you can freely &lt;a href="http://www.danielnaber.de/loook/loook.zip"&gt;download&lt;/a&gt; and install. Unzip the downloaded file into a directory of your choice.  On my Debian Etch system, I did not have to install any additional packages for &lt;span style="font-style:italic;"&gt;loook&lt;/span&gt; to run.&lt;br /&gt;&lt;br /&gt;Running the tool cannot be any simpler.  Open a bash shell, and enter:&lt;br /&gt;&lt;pre&gt;$ python somedir/loook.py &lt;/pre&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_D7BpcWFofE4/SixaRmoumTI/AAAAAAAAAGo/e_ASZSR7rxM/s1600-h/loookscr.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 194px;" src="http://3.bp.blogspot.com/_D7BpcWFofE4/SixaRmoumTI/AAAAAAAAAGo/e_ASZSR7rxM/s200/loookscr.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5344746116257585458" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-style:italic;"&gt;Viewer&lt;/span&gt; field has the default value: &lt;span style="font-style:italic;"&gt;soffice&lt;/span&gt;.  This is the name of the OpenOffice executable.  You don't need to change this field unless your version of OpenOffice has a different name or the executable is not in your default PATH.&lt;br /&gt;&lt;br /&gt;What you do want to change are the following fields:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;  &lt;li&gt;Search Path&lt;br /&gt;  &lt;li&gt;Search Terms&lt;br /&gt;  &lt;li&gt;Mode&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Search Path&lt;/span&gt;&lt;br /&gt;&lt;p&gt;You navigate or type in the path of the directory containing the OpenOffice files you want to search.   &lt;span style="font-style:italic;"&gt;loook&lt;/span&gt; will recursively search the hierarchy starting from the specified directory.  Unfortunately, you are limited to specifying one starting directory only.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Search Terms&lt;/span&gt;&lt;br /&gt;&lt;p&gt;You enter your search terms in this field.  Note that &lt;span style="font-weight:bold;"&gt;loook&lt;/span&gt; supports Unicode.  Non-English language users can search using UTF-8 characters. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Mode&lt;/span&gt;&lt;br /&gt;&lt;p&gt;The Mode determines whether a match requires all the search terms to be present in a document (&lt;span style="font-style:italic;"&gt;AND&lt;/span&gt; search), any of the terms to be present (&lt;span style="font-style:italic;"&gt;OR&lt;/span&gt; search), or the terms must appear together &lt;span style="font-style:italic;"&gt;(PHRASE&lt;/span&gt; search).&lt;br /&gt;&lt;br /&gt;You can pre-populate the search path and the search terms.  Simply enter them as arguments to &lt;span style="font-style:italic;"&gt;loook&lt;/span&gt; on the command line.  For example, &lt;br /&gt;&lt;pre&gt;$ python somedir/loook.py /home/peter/mydocs "Cisco Routers"&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_D7BpcWFofE4/Sixt-kIE3SI/AAAAAAAAAGw/coLxHnPm6UE/s1600-h/loookscr2.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 140px;" src="http://1.bp.blogspot.com/_D7BpcWFofE4/Sixt-kIE3SI/AAAAAAAAAGw/coLxHnPm6UE/s200/loookscr2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5344767779398802722" /&gt;&lt;/a&gt;&lt;br /&gt;The search results are returned in the &lt;span style="font-weight:bold;"&gt;Matches&lt;/span&gt; field.  Note that only the full path of the files are returned.  It does not display the actual matches.  You can double click the file path in the &lt;span style="font-weight:bold;"&gt;Matches&lt;/span&gt; field to directly open the file with OpenOffice.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;loook&lt;/span&gt; does not have all the bells and whistles that you expect of a desktop search tool, with respect to both features and  supported file formats.  However, if all you want is a light-weight tool for searching OpenOffice documents in a directory structure, it is worth your time to try it out.&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2009/06/loook-light-weight-text-search-tool-for.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2009/06/loook-light-weight-text-search-tool-for.html&amp;title=loook:%20A%20light-weight%20text%20search%20tool%20for%20OpenOffice"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-7350097472364037502?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Vr3II9ebq95Rt9L1EfnzJr9QsNQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Vr3II9ebq95Rt9L1EfnzJr9QsNQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Vr3II9ebq95Rt9L1EfnzJr9QsNQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Vr3II9ebq95Rt9L1EfnzJr9QsNQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/7350097472364037502/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=7350097472364037502&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/7350097472364037502?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/7350097472364037502?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2009/06/loook-light-weight-text-search-tool-for.html" title="loook: A light-weight text search tool for OpenOffice documents" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_D7BpcWFofE4/SixaRmoumTI/AAAAAAAAAGo/e_ASZSR7rxM/s72-c/loookscr.jpg" height="72" width="72" /><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;CEcARXo6eSp7ImA9WxJRF0Q.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-2573887116732714120</id><published>2009-05-18T04:28:00.000-07:00</published><updated>2009-05-19T21:00:44.411-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-19T21:00:44.411-07:00</app:edited><title>Is PHP supported on my Web Server?</title><content type="html">Recently, I had to install a PHP-based web application on my Apache web server.&lt;br /&gt;&lt;br /&gt;My first question was: "Is PHP enabled on the web server?"&lt;br /&gt;&lt;br /&gt;You can always ask the systems guy.  But if you happen to be the systems guy, and you don't quite remember if you have installed PHP, here is how to find out.&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;Create a new file with a php suffix (say &lt;span style="font-style:italic;"&gt;myphp.php&lt;/span&gt;)&lt;br /&gt;&lt;li&gt;Copy and paste the following code into the php file:&lt;br /&gt;&lt;pre&gt;&lt;?php phpinfo(); ?&gt;&lt;/pre&gt;&lt;br /&gt;&lt;li&gt;Save the file and upload it to a location on your web server that is accessible to the World Wide Web.&lt;br /&gt;For expedience, upload it to the Apache document root directory which is &lt;span style="font-style:italic;"&gt;/var/www&lt;/span&gt; on my Debian Etch server.&lt;br /&gt;&lt;li&gt;Open your web browser to the URL for that PHP file (&lt;span style="font-style:italic;"&gt;http://localhost/myphp.php&lt;/span&gt;).&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_D7BpcWFofE4/Sg8xxfyNERI/AAAAAAAAAGg/ywHq2w_g_GU/s1600-h/php.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 147px;" src="http://4.bp.blogspot.com/_D7BpcWFofE4/Sg8xxfyNERI/AAAAAAAAAGg/ywHq2w_g_GU/s200/php.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5336538809872748818" /&gt;&lt;/a&gt;&lt;br /&gt;If your web server supports PHP, the browser will return with a page full of information about the PHP version and configuration.  In addition, it will display information about your web server and your system in general.&lt;br /&gt;&lt;br /&gt;On the contrary, if all you see is a blank page, then you know PHP is not supported.&lt;br /&gt;&lt;br /&gt;Note that you must delete the &lt;span style="font-style:italic;"&gt;myphp.php&lt;/span&gt; file from your web server after you obtain the necessary info.  You don't want people to run the PHP script, and obtain sensitive information about your system.&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2009/05/is-php-supported-on-my-web-server.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2009/05/is-php-supported-on-my-web-server.html&amp;title=Is%20PHP%20supported%20on%20my%20Web%20Server\?"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-2573887116732714120?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Mdgh-O1GZIxVqVB_zWazWGyP63I/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Mdgh-O1GZIxVqVB_zWazWGyP63I/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Mdgh-O1GZIxVqVB_zWazWGyP63I/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Mdgh-O1GZIxVqVB_zWazWGyP63I/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/2573887116732714120/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=2573887116732714120&amp;isPopup=true" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/2573887116732714120?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/2573887116732714120?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2009/05/is-php-supported-on-my-web-server.html" title="Is PHP supported on my Web Server?" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_D7BpcWFofE4/Sg8xxfyNERI/AAAAAAAAAGg/ywHq2w_g_GU/s72-c/php.jpg" height="72" width="72" /><thr:total>3</thr:total></entry><entry gd:etag="W/&quot;C0YBRXg6eCp7ImA9WxJRFU0.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-7201054035405326118</id><published>2009-05-16T12:03:00.001-07:00</published><updated>2009-05-16T12:12:34.610-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-16T12:12:34.610-07:00</app:edited><title>More on Inserting Arguments from Previous Commands</title><content type="html">I previously blogged on using the shortcut &lt;span style="font-style:italic;"&gt;Alt + dot &lt;/span&gt;to &lt;a href="http://linuxcommando.blogspot.com/2009/05/surefire-shortcut-to-insert-last.html" &gt;insert the last argument from the previous command&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Suppose you don't want the last argument.  Instead, you want to insert the first, second, or third  argument of a previous command.&lt;br /&gt;&lt;br /&gt;No problem!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Alt + 1 + dot&lt;/span&gt; inserts the first argument of the last command.  To key it in properly, hold the &lt;span style="font-style:italic;"&gt;alt&lt;/span&gt; key, press the &lt;span style="font-style:italic;"&gt;1&lt;/span&gt; key, and then the &lt;span style="font-style:italic;"&gt;dot&lt;/span&gt; (".") key.&lt;br /&gt;&lt;br /&gt;Similarly, &lt;span style="font-style:italic;"&gt;alt + 2 + dot &lt;/span&gt;inserts the second command argument.&lt;br /&gt;&lt;br /&gt;For example, you just executed this command.&lt;br /&gt;&lt;pre&gt;$ ls -l /home/peter/somefile.txt   secondfile.txt&lt;br /&gt;-rw-r--r-- 1 peter peter 8115 2007-12-19 21:03 somefile.txt&lt;br /&gt;$ &lt;/pre&gt;&lt;br /&gt;If you now type in &lt;span style="font-style:italic;"&gt;cat&lt;/span&gt; and then &lt;span style="font-style:italic;"&gt;alt + 2 + dot&lt;/span&gt;, it will insert the second argument from the last command (&lt;span style="font-style:italic;"&gt;-l &lt;/span&gt;is the first).&lt;br /&gt;&lt;pre&gt;$ cat /home/peter/somefile.txt &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can repeat the key sequence, and this will go back 1 command at a time, and insert the specified argument of that command.&lt;br /&gt;&lt;br /&gt;If you want just the command itself, not an argument, type in &lt;span style="font-style:italic;"&gt;alt + 0 + dot&lt;/span&gt; .&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;P.S. Related articles from this blog:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;a href="http://linuxcommando.blogspot.com/2009/05/surefire-shortcut-to-insert-last.html" &gt;A Surefire Shortcut to Insert the Last Argument of the Last Command&lt;/a&gt;.&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2009/05/more-on-inserting-arguments-from.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2009/05/more-on-inserting-arguments-from.html&amp;title=More on Inserting Arguments from Previous Commands"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-7201054035405326118?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/GGwpl92eI1FQcK7Xyw16M5eRjoI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GGwpl92eI1FQcK7Xyw16M5eRjoI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/GGwpl92eI1FQcK7Xyw16M5eRjoI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GGwpl92eI1FQcK7Xyw16M5eRjoI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/7201054035405326118/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=7201054035405326118&amp;isPopup=true" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/7201054035405326118?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/7201054035405326118?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2009/05/more-on-inserting-arguments-from.html" title="More on Inserting Arguments from Previous Commands" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;D0AESHs5fSp7ImA9WxJSGEk.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-5493203795926055853</id><published>2009-05-08T21:59:00.000-07:00</published><updated>2009-05-08T22:08:29.525-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-08T22:08:29.525-07:00</app:edited><title>Open a file from the command line using its default application</title><content type="html">Windows users are familiar with the concept of file association.  When you double click a file (say, cisco.doc), Windows examines the file name extension (doc), and opens the file using the default program associated with that extension(Office).&lt;br /&gt;&lt;br /&gt;Linux users can open files in a similar way in their X Window graphical user interface. But, if you want to open the file from the command-line, you need to type out at least the program name, &lt;span style="font-style:italic;"&gt;oowriter,&lt;/span&gt; or do you?&lt;br /&gt;&lt;pre&gt;$ oowriter cisco.doc &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If GNOME is your window manager, use the &lt;span style="font-style:italic;"&gt;gnome-open &lt;/span&gt;command as follow:&lt;br /&gt;&lt;pre&gt;$ gnome-open cisco.doc &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;oowriter&lt;/span&gt; is automatically started up to open cisco.doc, if &lt;span style="font-style:italic;"&gt;oowriter&lt;/span&gt; is indeed associated with the .doc file name extension. &lt;br /&gt;&lt;br /&gt;For KDE users, use &lt;span style="font-style:italic;"&gt;kde-open&lt;/span&gt; instead.&lt;br /&gt;&lt;br /&gt;Alternatively, you can run the window-manager-neutral program called &lt;span style="font-style:italic;"&gt;xdg-open&lt;/span&gt;.  &lt;span style="font-style:italic;"&gt;xdg-open&lt;/span&gt; is part of the &lt;span style="font-style:italic;"&gt;xdg-utils&lt;/span&gt; package.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$ xdg-open cisco.doc&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2009/05/open-file-from-command-line-using-its.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2009/05/open-file-from-command-line-using-its.html&amp;title=Open%20a%20file%20from%20the%20command%20line%20using%20its%20default%20application"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-5493203795926055853?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/E9DbfXJnuZ63nPUr7Q7jQ536D8Q/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/E9DbfXJnuZ63nPUr7Q7jQ536D8Q/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/E9DbfXJnuZ63nPUr7Q7jQ536D8Q/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/E9DbfXJnuZ63nPUr7Q7jQ536D8Q/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/5493203795926055853/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=5493203795926055853&amp;isPopup=true" title="11 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/5493203795926055853?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/5493203795926055853?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2009/05/open-file-from-command-line-using-its.html" title="Open a file from the command line using its default application" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>11</thr:total></entry><entry gd:etag="W/&quot;C04CQX0zcSp7ImA9WxJSFUk.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-1456935826068858606</id><published>2009-05-05T09:46:00.000-07:00</published><updated>2009-05-05T09:46:00.389-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-05T09:46:00.389-07:00</app:edited><title>Find all (non-)empty files in a directory</title><content type="html">Creating an empty file in Linux is easy.  If a-file does not exist, create the file and make it empty by simply:&lt;br /&gt;&lt;pre&gt;$ touch a-file&lt;br /&gt;$ ls -l a-file&lt;br /&gt;-rw-r--r-- 1 peter peter 0 2009-05-02 20:15 a-file&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Finding all empty files in a directory can also be done using a single command.  Ditto for non-empty files.&lt;br /&gt;&lt;br /&gt;Suppose you want to find all empty files in the directory &lt;span style="font-style:italic;"&gt;/home/peter&lt;/span&gt;.  The command is:&lt;br /&gt;&lt;pre&gt; $ find -L /home/peter -maxdepth 1  -type f -size 0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;By default, the &lt;span style="font-style:italic;"&gt;find&lt;/span&gt; command excludes symbolic files.  Use the &lt;span style="font-style:italic;"&gt;-L&lt;/span&gt; option to include them.&lt;br /&gt;&lt;br /&gt;The expression &lt;span style="font-style:italic;"&gt;-maxdepth 1&lt;/span&gt; specifies that the maximum depth to which the search will drill is one only. By default, the &lt;span style="font-style:italic;"&gt;find&lt;/span&gt; command will recursively go down the directory.   A maximum depth of 1 means that you only want the files directly under &lt;span style="font-style:italic;"&gt;/home/peter&lt;/span&gt;.  Keep in mind that depth 0 is the level of the command line argument (&lt;span style="font-style:italic;"&gt;/home/peter&lt;/span&gt;).  You can use &lt;span style="font-style:italic;"&gt;-maxdepth&lt;/span&gt; and &lt;span style="font-style:italic;"&gt;-mindepth&lt;/span&gt; to finely control the depth levels you want included.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;-type f&lt;/span&gt; means include regular files only.  This is not strictly necessary for empty files (as opposed to non-empty ones) because all directories, even those with no files, are of non-empty size.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;-size 0&lt;/span&gt; is self-explanatory.&lt;br /&gt;&lt;br /&gt;To find all non-empty files in the same directory, simply add &lt;span style="font-style:italic;"&gt;!&lt;/span&gt; before &lt;span style="font-style:italic;"&gt;-size 0&lt;/span&gt;:&lt;br /&gt;&lt;pre&gt; $ find -L /home/peter -maxdepth 1  -type f ! -size 0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note that &lt;span style="font-style:italic;"&gt;-type f&lt;/span&gt; becomes necessary.  Without this expression, subdirectories in &lt;span style="font-style:italic;"&gt;/home/peter&lt;/span&gt; such as &lt;span style="font-style:italic;"&gt;/home/peter/.Trash&lt;/span&gt; will appear in the output.  &lt;br /&gt;&lt;br /&gt;Most of the time, you don't just want to find the files: you want to do something with them.  Suppose you want to remove all empty files in the directory. For safety, first run the &lt;span style="font-style:italic;"&gt;find&lt;/span&gt; command by itself to list the files.  Then with the &lt;span style="font-style:italic;"&gt;xargs&lt;/span&gt; command as below.&lt;br /&gt;&lt;pre&gt; $ find -L /home/peter -maxdepth 1  -type f  -size 0 &lt;br /&gt;/home/peter/file1.txt&lt;br /&gt;/home/peter/file2.txt&lt;br /&gt;$ find -L /home/peter -maxdepth 1  -type f  -size 0 -print0 |xargs -0 -r rm -f &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;For more information about how to use the &lt;span style="font-style:italic;"&gt;find&lt;/span&gt; and &lt;span style="font-style:italic;"&gt;xargs&lt;/span&gt; commands, see my &lt;a href="http://linuxcommando.blogspot.com/2007/10/find-xargs-pipe.html" &gt;earlier blog entry&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2009/05/find-all-non-empty-files-in-directory.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2009/05/find-all-non-empty-files-in-directory.html&amp;title=Find%20all%20(non-)empty%20files%20in%20a%20directory"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-1456935826068858606?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/4y3i4Rn7SrhNr20eC6XJzGq1xCE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4y3i4Rn7SrhNr20eC6XJzGq1xCE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/4y3i4Rn7SrhNr20eC6XJzGq1xCE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4y3i4Rn7SrhNr20eC6XJzGq1xCE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/1456935826068858606/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=1456935826068858606&amp;isPopup=true" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/1456935826068858606?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/1456935826068858606?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2009/05/find-all-non-empty-files-in-directory.html" title="Find all (non-)empty files in a directory" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;C0QCRXwyfyp7ImA9WxJRFU0.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-745780371051107477</id><published>2009-05-02T14:05:00.000-07:00</published><updated>2009-05-16T12:16:04.297-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-16T12:16:04.297-07:00</app:edited><title>A surefire shortcut to Insert the Last Argument of the Last Command</title><content type="html">Sometimes, in the Linux command-line world, a seemingly trivial technique can turn out to be tremendously useful.  Before I discover the &lt;span style="font-style:italic;"&gt;Alt-dot&lt;/span&gt;(.) shortcut, I type &lt;span style="font-style:italic;"&gt;!$&lt;/span&gt; to insert the last argument of the previous command.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;peter@tiger:~$ ls -l Windows_20081110102654.log&lt;br /&gt;-rw-r--r-- 1 peter peter 808 2008-11-10 10:26 Windows_20081110102654.log&lt;br /&gt;peter@tiger:~$ cat !$&lt;br /&gt;cat Windows_20081110102654.log&lt;br /&gt;.....&lt;br /&gt;.....&lt;br /&gt;peter@tiger:~$&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;Then, I discovered that typing &lt;span style="font-style:italic;"&gt;Alt-dot&lt;/span&gt; achieves the same result.  That is, press (and hold) the &lt;span style="font-style:italic;"&gt;Alt&lt;/span&gt; key, then the &lt;span style="font-style:italic;"&gt;dot&lt;/span&gt; key.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;There are some advantages of using &lt;span style="font-style:italic;"&gt;Alt-dot&lt;/span&gt; over &lt;span style="font-style:italic;"&gt;!$&lt;/span&gt;.  First, you can actually see the argument immediately and interactively. You can verify that is indeed what you want, edit it if necessary, before you continue the command-line input, and eventually hit &lt;span style="font-style:italic;"&gt;Enter&lt;/span&gt; to execute the command.  With &lt;span style="font-style:italic;"&gt;!$&lt;/span&gt;, you better have a pretty good memory.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Another advantage is that you can repeatedly type &lt;span style="font-style:italic;"&gt;Alt-dot&lt;/span&gt;.  The net effect is that you scroll back in command history, and display the last argument of each successive command.&lt;br /&gt;&lt;p&gt;After assimilating the shortcut into my command-line work habit, I found that I have been using it a lot.  Give it a try!&lt;br /&gt;&lt;br /&gt;PS  Related entries from this blog:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;a href="http://linuxcommando.blogspot.com/2009/05/more-on-inserting-arguments-from.html"&gt;More on Inserting Arguments from Previous Commands&lt;/a&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2009/05/surefire-shortcut-to-insert-last.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2009/05/surefire-shortcut-to-insert-last.html&amp;title=Surefire%20shortcut%20to%20insert%20the%20last%20argument%20of%20the%20last%20command"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-745780371051107477?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/IyUMG7ipsfoJoenQjiyq8OFSC9k/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IyUMG7ipsfoJoenQjiyq8OFSC9k/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/IyUMG7ipsfoJoenQjiyq8OFSC9k/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IyUMG7ipsfoJoenQjiyq8OFSC9k/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/745780371051107477/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=745780371051107477&amp;isPopup=true" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/745780371051107477?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/745780371051107477?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2009/05/surefire-shortcut-to-insert-last.html" title="A surefire shortcut to Insert the Last Argument of the Last Command" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>7</thr:total></entry><entry gd:etag="W/&quot;C08DRXwyeSp7ImA9WxRbGE8.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-3434442460226322951</id><published>2008-12-06T17:30:00.001-08:00</published><updated>2008-12-09T03:24:34.291-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-12-09T03:24:34.291-08:00</app:edited><title>Auto Start Applications at Login to GNOME Desktop</title><content type="html">It may sound trivial, but for the longest time, I, being an avid CLI fan, did not configure GNOME to auto-start certain applications after login to desktop.&lt;br /&gt;&lt;br /&gt;A couple of times, I actually went looking for some entry similar to Microsoft Windows Startup menu in the GNOME menu structures, but each time, I came up empty and frustrated.&lt;br /&gt;&lt;br /&gt;Finally, I found out how, and I wrote it down.  The following works for the GNOME Desktop 2.14.3 using the Debian Etch Linux distribution. &lt;br /&gt;&lt;br /&gt;To configure GNOME to auto start an application on login,&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;  &lt;li&gt; Mouse to &lt;span style="font-style:italic;"&gt;Desktop&lt;/span&gt; -&gt; &lt;span style="font-style:italic;"&gt;Preferences&lt;/span&gt; -&gt; &lt;span style="font-style:italic;"&gt;Sessions&lt;/span&gt;.&lt;br /&gt;  &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_D7BpcWFofE4/STs1jSYvYdI/AAAAAAAAAF4/QanvOAtUUPs/s1600-h/autostart1.jpg"&gt;&lt;img style="margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 150px;" src="http://2.bp.blogspot.com/_D7BpcWFofE4/STs1jSYvYdI/AAAAAAAAAF4/QanvOAtUUPs/s200/autostart1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5276870268741968338" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br&gt;&lt;/li&gt;&lt;br /&gt;  &lt;li&gt; Click to select the &lt;span style="font-style:italic;"&gt;Startup Programs&lt;/span&gt; Tab.&lt;br /&gt;  &lt;li&gt; Click &lt;span style="font-style:italic;"&gt;Add&lt;/span&gt;.&lt;br&gt;&lt;br /&gt;  &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_D7BpcWFofE4/STs1jnqzS5I/AAAAAAAAAGA/DodKm-iuxlQ/s1600-h/autostart2.jpg"&gt;&lt;img style="margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 150px;" src="http://3.bp.blogspot.com/_D7BpcWFofE4/STs1jnqzS5I/AAAAAAAAAGA/DodKm-iuxlQ/s200/autostart2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5276870274454866834" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;  &lt;li&gt; Enter the command, e.g., &lt;span style="font-style:italic;"&gt;skype&lt;/span&gt;, and click &lt;span style="font-style:italic;"&gt;OK&lt;/span&gt;.&lt;br /&gt;  &lt;br&gt; Note: You may need to enter the full path for the command, (e.g., &lt;span style="font-style:italic;"&gt;/etc/bin/skype&lt;/span&gt;) if the command is not in the command path.&lt;br /&gt;  &lt;li&gt; Click &lt;span style="font-style:italic;"&gt;Close&lt;/span&gt; to exit &lt;span style="font-style:italic;"&gt;Sessions&lt;/span&gt; dialog box.&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javscript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2008/12/auto-start-applications-at-login-to.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2008/12/auto-start-applications-at-login-to.html&amp;title=How%20to%20Auto%20Start%20Applications%20at%20Login%20to%20GNOME%20Desktop"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-3434442460226322951?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8DI_LAjsGq7sVdooD4UNlf_im9g/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8DI_LAjsGq7sVdooD4UNlf_im9g/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8DI_LAjsGq7sVdooD4UNlf_im9g/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8DI_LAjsGq7sVdooD4UNlf_im9g/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/3434442460226322951/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=3434442460226322951&amp;isPopup=true" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/3434442460226322951?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/3434442460226322951?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2008/12/auto-start-applications-at-login-to.html" title="Auto Start Applications at Login to GNOME Desktop" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_D7BpcWFofE4/STs1jSYvYdI/AAAAAAAAAF4/QanvOAtUUPs/s72-c/autostart1.jpg" height="72" width="72" /><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;C08DRX07fyp7ImA9WxRbGE8.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-6550754145861203981</id><published>2008-11-29T11:48:00.000-08:00</published><updated>2008-12-09T03:24:34.307-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-12-09T03:24:34.307-08:00</app:edited><title>How to increase number of disk mounts before next fsck at system boot</title><content type="html">Many home users often power off their computers when they are not being used.  Some do it to be green:  turning idle computers off saves electricity and $$. Others do it for the extra security. To those who are hard-core Linux geeks, machine uptime is sacred, and voluntarily rebooting the machine is nothing but sacrilegious.&lt;br /&gt;&lt;br /&gt;If you do reboot your machine from time to time, you most definitely have encountered a most annoying experience.  Once in a while, while the computer is booting up, you see the message &lt;span style="font-style:italic;"&gt;/dev/hdaN has reached maximal mount count, check forced&lt;/span&gt;.  The check seems to take forever, and the system boot won't resume until the check is over.&lt;br /&gt;&lt;br /&gt;The check refers to a file system check performed using the &lt;span style="font-style:italic;"&gt;fsck&lt;/span&gt; command. For many Linux distributions, by default, the system will do a &lt;span style="font-style:italic;"&gt;fsck&lt;/span&gt; check on a file system after it has been mounted 30 times, which means after 30 reboots. This is the maximum mount count before &lt;span style="font-style:italic;"&gt;fsck&lt;/span&gt; is performed on the file system.&lt;br /&gt;&lt;br /&gt;You can specify a maximum mount count for each individual partition on your hard drive.  To find out the maximum mount count for &lt;span style="font-style:italic;"&gt;/dev/hda1&lt;/span&gt;, execute this command as root:&lt;br /&gt;&lt;pre&gt;$ tune2fs -l /dev/hda1 | grep 'Maximum mount count'&lt;br /&gt;Maximum mount count:      30&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note that the &lt;span style="font-style:italic;"&gt;tune2fs&lt;/span&gt; command is only applicable for &lt;span style="font-style:italic;"&gt;ext2&lt;/span&gt; and  &lt;span style="font-style:italic;"&gt;ext3 &lt;/span&gt;file systems.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-style:italic;"&gt;tune2fs&lt;/span&gt; command can also tell you how many times a file system has actually been mounted since the last &lt;span style="font-style:italic;"&gt;fsck&lt;/span&gt; check.&lt;br /&gt;&lt;pre&gt;$ tune2fs -l /dev/hda1 |grep 'Mount count'&lt;br /&gt;Mount count:    17 &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To increase the maximum mount count, you will use the same &lt;span style="font-style:italic;"&gt;tune2fs&lt;/span&gt; command but with the &lt;span style="font-style:italic;"&gt;-c&lt;/span&gt; option.&lt;br /&gt;&lt;br /&gt;Note that you should not modify the maximum mount count which is a file system parameter while the file system is mounted. The recommended way is to boot your system using a Linux Live CD, and then run &lt;span style="font-style:italic;"&gt;tune2fs&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;For me, I happened to have a &lt;a href="http://www.ubuntu.com/getubuntu/download" &gt;Ubuntu&lt;/a&gt; 7.10 Live CD at my desk.  I inserted the Live CD to boot up my system.  Then, I opened a Terminal window, &lt;span style="font-style:italic;"&gt;sudo -s&lt;/span&gt;, and executed the following commands.&lt;br /&gt;&lt;br /&gt;First, I reminded myelf of how the &lt;span style="font-style:italic;"&gt;/dev/hda&lt;/span&gt; disk is partitioned: &lt;br /&gt;&lt;pre&gt;$ fdisk -l /dev/hda&lt;br /&gt;Disk /dev/hda: 82.3 GB, 82348277760 bytes&lt;br /&gt;255 heads, 63 sectors/track, 10011 cylinders&lt;br /&gt;Units = cylinders of 16065 * 512 = 8225280 bytes&lt;br /&gt;&lt;br /&gt;   Device Boot      Start         End      Blocks   Id  System&lt;br /&gt;/dev/hda1   *           1          31      248976   83  Linux&lt;br /&gt;/dev/hda2              32       10011    80164350    5  Extended&lt;br /&gt;/dev/hda5              32       10011    80164318+  8e  Linux LVM&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To increase the maximum mount count to 50 for &lt;span style="font-style:italic;"&gt;/dev/hda1&lt;/span&gt;:&lt;br /&gt;&lt;pre&gt;$ tune2fs -c 50 /dev/hda1&lt;br /&gt;tune2fs 1.40.2 (12-Jul-2007)&lt;br /&gt;Setting maximal mount count to 50&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If there are more than 1 file system on your hard drive, you should stagger the maximum mount count for the different file systems so that they don't all trigger the lengthy &lt;span style="font-style:italic;"&gt;fsck&lt;/span&gt; at the same time.  For example, set the maximum mount count to 40, 50 and 60 for &lt;span style="font-style:italic;"&gt;/dev/hda1&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;hda2&lt;/span&gt;, and &lt;span style="font-style:italic;"&gt;hda3&lt;/span&gt; respectively.&lt;br /&gt;&lt;br /&gt;In the above case, &lt;span style="font-style:italic;"&gt;/dev/hda5&lt;/span&gt; is a physical LVM volume.   You cannot run &lt;span style="font-style:italic;"&gt;tune2fs&lt;/span&gt; on physical LVM volumes directly.&lt;br /&gt;&lt;pre&gt;$ tune2fs -l /dev/hda5&lt;br /&gt;tune2fs 1.40.2 (12-Jul-2007)&lt;br /&gt;tune2fs: Bad magic number in super-block while trying to open /dev/hda5&lt;br /&gt;Couldn't find valid filesystem superblock.&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You need to run &lt;span style="font-style:italic;"&gt;tune2fs&lt;/span&gt; against each logical LVM volume.  To find out their names, &lt;span style="font-style:italic;"&gt;cat /etc/fstab&lt;/span&gt;.&lt;br /&gt;&lt;pre&gt;$ tune2fs -c 60 /dev/mapper/myhost-root &lt;br /&gt;tune2fs 1.40.2 (12-Jul-2007)&lt;br /&gt;Setting maximal mount count to 60&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javscript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2008/11/how-to-increase-number-of-disk-mounts.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2008/11/how-to-increase-number-of-disk-mounts.html&amp;title=How%20to%20increase%20number%20of%20disk%20mounts%20before%20next%20fsck%20at%20system%20boot"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-6550754145861203981?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/K499vJLamcjUl-NiX41w9Sv7F2o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/K499vJLamcjUl-NiX41w9Sv7F2o/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/K499vJLamcjUl-NiX41w9Sv7F2o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/K499vJLamcjUl-NiX41w9Sv7F2o/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/6550754145861203981/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=6550754145861203981&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/6550754145861203981?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/6550754145861203981?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2008/11/how-to-increase-number-of-disk-mounts.html" title="How to increase number of disk mounts before next fsck at system boot" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;D0YHQ3w8eSp7ImA9WxRVFkw.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-2165340127982084645</id><published>2008-11-08T19:21:00.000-08:00</published><updated>2008-11-13T14:25:32.271-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-13T14:25:32.271-08:00</app:edited><title>How to open and close the CD DVD tray</title><content type="html">You can open/close the CD, DVD disk tray from the command line.&lt;br /&gt;&lt;br /&gt;Many Linux users already know about the &lt;span style="font-style:italic;"&gt;eject&lt;/span&gt; command for opening the disk tray:&lt;br /&gt;&lt;pre&gt; $ eject&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;How do you close the tray?&lt;br /&gt;&lt;br /&gt;Turns out that you can use the same &lt;span style="font-style:italic;"&gt;eject&lt;/span&gt; command but with an additional &lt;span style="font-style:italic;"&gt;-t&lt;/span&gt; option to close the tray.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$ eject -t &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Before I found out about the -t option, I always had to reach and press the open/close button on the drive to close the tray.   With the -t option, you can now both open and close the tray  from the command line.&lt;br /&gt;&lt;br /&gt;There is another option &lt;span style="font-style:italic;"&gt;-T &lt;/span&gt;(CAPITAL T, that is) you should know.&lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;br /&gt;eject -T &lt;/span&gt;basically closes the tray if it is open, and opens the tray if it is closed.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-style:italic;"&gt;man&lt;/span&gt; page for &lt;span style="font-style:italic;"&gt;eject&lt;/span&gt; has detailed explanation about the options.&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2008/11/how-to-open-and-close-cd-dvd-tray.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2008/11/how-to-open-and-close-cd-dvd-tray.html&amp;title=How%20to%20open%20and%20close%20the%20CD%20DVD%20tray"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-2165340127982084645?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/D9AseSWbY3-LRGBnclAB3-m0ouM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/D9AseSWbY3-LRGBnclAB3-m0ouM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/D9AseSWbY3-LRGBnclAB3-m0ouM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/D9AseSWbY3-LRGBnclAB3-m0ouM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/2165340127982084645/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=2165340127982084645&amp;isPopup=true" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/2165340127982084645?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/2165340127982084645?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2008/11/how-to-open-and-close-cd-dvd-tray.html" title="How to open and close the CD DVD tray" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;D0YHQ30-cCp7ImA9WxRVFkw.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-3638975949190034209</id><published>2008-11-02T21:05:00.000-08:00</published><updated>2008-11-13T14:25:32.358-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-13T14:25:32.358-08:00</app:edited><title>Two additional ways to tail a log file</title><content type="html">I want to revisit a topic: how to tail a log file.   My earlier posts discussed the use of &lt;a href="http://linuxcommando.blogspot.com/2007/11/log-watching-using-tail-or-less.html" &gt;tail and less&lt;/a&gt; commands to tail a log file, and &lt;a href="http://linuxcommando.blogspot.com/2007/11/tail-multiple-files.html" &gt;multitail&lt;/a&gt; if you need to tail multiple files at once.&lt;br /&gt;&lt;br /&gt;This followup article discussed two other ways to tail a log file: the use of the &lt;span style="font-style:italic;"&gt;most&lt;/span&gt; command, and to tail within &lt;a href="http://www.gnu.org/software/emacs" &gt;emacs&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-style:italic;"&gt;most&lt;/span&gt; command bills itself as a replacement for &lt;span style="font-style:italic;"&gt;less&lt;/span&gt;.   Like its predecessors &lt;span style="font-style:italic;"&gt;less&lt;/span&gt; and &lt;span style="font-style:italic;"&gt;more&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;most&lt;/span&gt; is a file pager program.&lt;br /&gt;&lt;br /&gt;To install &lt;span style="font-style:italic;"&gt;most&lt;/span&gt; on my Debian Etch system:&lt;br /&gt;&lt;pre&gt;$ apt-get update &amp;&amp; apt-get install most&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To page the log file say &lt;span style="font-style:italic;"&gt;/var/log/messages&lt;/span&gt;:&lt;br /&gt;&lt;pre&gt;$ most /var/log/messages&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This opens the log file, and displays the first page.&lt;br /&gt;&lt;br /&gt;To tail the file, put &lt;span style="font-style:italic;"&gt;most&lt;/span&gt; into Tail Mode by pressing the &lt;span style="font-style:italic;"&gt;F&lt;/span&gt; key (capital F).&lt;br /&gt;&lt;br /&gt;You should see the following line in the status area at the bottom of the tail window.&lt;br /&gt;&lt;pre&gt;Most Tail Mode--  MOST keys are still active.&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If a new line is appended to the log file, &lt;span style="font-style:italic;"&gt;most&lt;/span&gt; will automatically reposition the file to the end and display the new line.&lt;br /&gt;&lt;br /&gt;Note that you can scroll the file or do a search when you are in Tail Mode.  For example, you can press the PageUp/PageDown, UpArrow/DownArrow keys to scroll the file.  Also, you can press / to search forward or ? to search backward.  However, when you press a key in Tail Mode, you break out of Tail mode in the sense that newly appended lines are not automatically displayed in the window.  Yet, you can hit &lt;span style="font-style:italic;"&gt;F&lt;/span&gt; again to re-enter Tail Mode, or simply use the DownArrow scroll key to scroll past the end of file to fetch the new lines.&lt;br /&gt;&lt;br /&gt;To quit &lt;span style="font-style:italic;"&gt;most&lt;/span&gt;, press the &lt;span style="font-style:italic;"&gt;q&lt;/span&gt; key.&lt;br /&gt;&lt;br /&gt;For my fellow emacs users out there, another way to tail a log file is to do it right within emacs.&lt;br /&gt;&lt;br /&gt;You need the &lt;span style="font-style:italic;"&gt;tail-file&lt;/span&gt; elisp function which is in the &lt;span style="font-style:italic;"&gt;emacs-goodies-el&lt;/span&gt; package. Debian users can install this package like this:&lt;br /&gt;&lt;pre&gt;$ apt-get update &amp;&amp; apt-get install emacs-goodies.el&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To tail a file in emacs:  start emacs, hit M-x (Alt and x keys together), and type &lt;span style="font-style:italic;"&gt;tail-file&lt;/span&gt;.  Then, enter the filename to tail.  The net result is that this will spawn an external &lt;span style="font-style:italic;"&gt;tail -f&lt;/span&gt; process.&lt;br /&gt;&lt;br /&gt;Note that you can't read the entire file under emacs using &lt;span style="font-style:italic;"&gt;tail-file&lt;/span&gt;, only the tail initially and the newly appended lines portion afterwards.&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2008/11/two-additional-ways-to-tail-log-file.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2008/11/two-additional-ways-to-tail-log-file.html&amp;title=Two%20additional%20ways%20to%20tail%20a%20file"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-3638975949190034209?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/73MapR8lWMtWUzbpDFrd11BREsM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/73MapR8lWMtWUzbpDFrd11BREsM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/73MapR8lWMtWUzbpDFrd11BREsM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/73MapR8lWMtWUzbpDFrd11BREsM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/3638975949190034209/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=3638975949190034209&amp;isPopup=true" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/3638975949190034209?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/3638975949190034209?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2008/11/two-additional-ways-to-tail-log-file.html" title="Two additional ways to tail a log file" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;D0YHQ308eSp7ImA9WxRVFkw.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-5716280258965781227</id><published>2008-10-18T20:36:00.001-07:00</published><updated>2008-11-13T14:25:32.371-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-13T14:25:32.371-08:00</app:edited><title>How to disable SSH host key checking</title><content type="html">Remote login using the &lt;a href="http://en.wikipedia.org/wiki/Secure_Shell" &gt;SSH&lt;/a&gt; protocol is a frequent activity in today's internet world.  With the SSH protocol, the onus is on the SSH client to verify the identity of the host to which it is connecting.  The host identify is established by its SSH host key.  Typically, the host key is auto-created during initial SSH installation setup.&lt;br /&gt;&lt;br /&gt;By default, the SSH client verifies the host key against a local file containing known, rustworthy machines.  This provides protection against possible &lt;a href="http://en.wikipedia.org/wiki/Man-in-the-middle_attack" &gt;Man-In-The-Middle attacks&lt;/a&gt;.  However, there are situations in which you want to bypass this verification step.  This article explains how to disable host key checking using &lt;a href="http://www.openssh.com/"&gt;OpenSSH&lt;/a&gt;, a popular Free and Open-Source implementation of SSH.&lt;br /&gt;&lt;br /&gt;When you login to a remote host for the first time, the remote host's host key is most likely  unknown to the SSH client. The default behavior is to ask the user to confirm the fingerprint of the host key.&lt;br /&gt;&lt;pre&gt;$ ssh peter@192.168.0.100&lt;br /&gt;The authenticity of host '192.168.0.100 (192.168.0.100)' can't be established.&lt;br /&gt;RSA key fingerprint is 3f:1b:f4:bd:c5:aa:c1:1f:bf:4e:2e:cf:53:fa:d8:59.&lt;br /&gt;Are you sure you want to continue connecting (yes/no)? &lt;/pre&gt;&lt;br /&gt;If your answer is &lt;span style="font-style:italic;"&gt;yes&lt;/span&gt;, the SSH client continues login, and stores the host key locally in the file &lt;span style="font-style:italic;"&gt;~/.ssh/known_hosts&lt;/span&gt;.  You only need to validate the host key the first time around: in subsequent logins, you will not be prompted to confirm it again.&lt;br /&gt;&lt;br /&gt;Yet, from time to time, when you try to remote login to the same host from the same origin, you may be refused with the following warning message:&lt;br /&gt;&lt;pre&gt;$ ssh peter@192.168.0.100&lt;br /&gt;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&lt;br /&gt;@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @&lt;br /&gt;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&lt;br /&gt;IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!&lt;br /&gt;Someone could be eavesdropping on you right now (man-in-the-middle attack)!&lt;br /&gt;It is also possible that the RSA host key has just been changed.&lt;br /&gt;The fingerprint for the RSA key sent by the remote host is&lt;br /&gt;3f:1b:f4:bd:c5:aa:c1:1f:bf:4e:2e:cf:53:fa:d8:59.&lt;br /&gt;Please contact your system administrator.&lt;br /&gt;Add correct host key in /home/peter/.ssh/known_hosts to get rid of this message.&lt;br /&gt;Offending key in /home/peter/.ssh/known_hosts:3&lt;br /&gt;RSA host key for 192.168.0.100 has changed and you have requested strict checking.&lt;br /&gt;Host key verification failed.$&lt;/pre&gt;&lt;br /&gt;There are multiple possible reasons why the remote host key changed. A Man-in-the-Middle attack is only one possible reason.  Other possible reasons include:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;OpenSSH was re-installed on the remote host but, for whatever reason, the original host key was not restored.&lt;br /&gt;&lt;li&gt;The remote host was replaced legitimately by another machine. &lt;/ul&gt;&lt;br /&gt;If you are sure that this is harmless, you can use either 1 of 2 methods below to trick openSSH to let you login. But be warned that you have become vulnerable to man-in-the-middle attacks. &lt;br /&gt;&lt;br /&gt;The first method is to remove the remote host from the &lt;span style="font-style:italic;"&gt;~/.ssh/known_hosts&lt;/span&gt; file.  Note that the warning message already tells you the line number in the known_hosts file that corresponds to the target remote host.  The offending line in the above example is line 3("Offending key in /home/peter/.ssh/known_hosts:3")&lt;br /&gt;&lt;br /&gt;You can use the following one liner to remove that one line (line 3) from the file.&lt;br /&gt;&lt;pre&gt;$ sed -i 3d ~/.ssh/known_hosts&lt;/pre&gt;&lt;br /&gt;Note that with the above method, you will be prompted to confirm the host key fingerprint when you run ssh to login.&lt;br /&gt;&lt;br /&gt;The second method uses two openSSH parameters:&lt;br /&gt;&lt;ul&gt;  &lt;li&gt;&lt;span style="font-style:italic;"&gt;StrictHostKeyCheckin&lt;/span&gt;, and&lt;/li&gt;&lt;br /&gt;  &lt;li&gt;&lt;span style="font-style:italic;"&gt;UserKnownHostsFile&lt;/span&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;This method tricks SSH by configuring it to use an empty &lt;span style="font-style:italic;"&gt;known_hosts&lt;/span&gt; file, and NOT to ask you to confirm the remote host identity key.&lt;br /&gt;&lt;pre&gt;$ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no peter@192.168.0.100&lt;br /&gt;Warning: Permanently added '192.168.0.100' (RSA) to the list of known hosts.&lt;br /&gt;peter@192.168.0.100's password:&lt;/pre&gt;&lt;br /&gt;The &lt;span style="font-style:italic;"&gt;UserKnownHostsFile&lt;/span&gt; parameter specifies the database file to use for storing the user host keys (default is &lt;span style="font-style:italic;"&gt;~/.ssh/known_hosts&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-style:italic;"&gt;&lt;a href="http://en.wikipedia.org/wiki/Data_sink" &gt;/dev/null&lt;/a&gt;&lt;/span&gt; file is a special system device file that discards anything and everything written to it, and when used as the input file, returns End Of File immediately.&lt;br /&gt;&lt;br /&gt;By configuring the null device file as the host key database, SSH is fooled into thinking that the SSH client has never connected to any SSH server before, and so will never run into a mismatched host key.&lt;br /&gt;&lt;br /&gt;The parameter &lt;span style="font-style:italic;"&gt;StrictHostKeyChecking&lt;/span&gt; specifies if SSH will automatically add new host keys to the host key database file. By setting it to &lt;span style="font-style:italic;"&gt;no&lt;/span&gt;, the host key is automatically added, without user confirmation, for all first-time connection. Because of the null key database file, all connection is viewed as the first-time for any SSH server host.  Therefore, the host key is automatically added to the host key database with no user confirmation.  Writing the key to the &lt;span style="font-style:italic;"&gt;/dev/null&lt;/span&gt; file discards the key and reports success.&lt;br /&gt;&lt;br /&gt;Please refer to this excellent &lt;a href="http://www.securityfocus.com/infocus/1806" &gt;article&lt;/a&gt; about host keys and key checking.&lt;br /&gt;&lt;br /&gt;By specifying the above 2 SSH options on the command line, you can bypass host key checking for that particular SSH login. If you want to bypass host key checking on a permanent basis, you need to specify those same options in the SSH configuration file.&lt;br /&gt;&lt;br /&gt;You can edit the global SSH configuration file (&lt;span style="font-style:italic;"&gt;/etc/ssh/ssh_config&lt;/span&gt;) if you want to make the changes permanent for all users.&lt;br /&gt;&lt;br /&gt;If you want to target a particular user, modify the user-specific SSH configuration file (&lt;span style="font-style:italic;"&gt;~/.ssh/config&lt;/span&gt;).    The instructions below apply to both files.&lt;br /&gt;&lt;br /&gt;Suppose you want to bypass key checking for a particular subnet (192.168.0.0/24).&lt;br /&gt;&lt;br /&gt;Add the following lines to the beginning of the SSH configuration file.&lt;br /&gt;&lt;pre&gt;Host 192.168.0.*&lt;br /&gt;   StrictHostKeyChecking no&lt;br /&gt;   UserKnownHostsFile=/dev/null&lt;/pre&gt;&lt;br /&gt;Note that the configuration file should have a line like &lt;span style="font-style:italic;"&gt;Host *&lt;/span&gt; followed by one or more parameter-value pairs.  &lt;span style="font-style:italic;"&gt;Host *&lt;/span&gt;means that it will match any host.  Essentially, the parameters following &lt;span style="font-style:italic;"&gt;Host *&lt;/span&gt; are the general defaults.  Because the first matched value for each SSH parameter is used, you want to add the host-specific or subnet-specific parameters to the beginning of the file.&lt;br /&gt;&lt;br /&gt;As a final word of caution, unless you know what you are doing, it is probably best to bypass key checking on a case by case basis, rather than making blanket permanent changes to the SSH configuration files.&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2008/10/how-to-disable-ssh-host-key-checking.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2008/10/how-to-disable-ssh-host-key-checking.html&amp;title=How%20to%20disable%20SSH%20host%20key%20checking"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-5716280258965781227?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/GWThlWTtxV_EJJ7uu2zRO2C4mZ0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GWThlWTtxV_EJJ7uu2zRO2C4mZ0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/GWThlWTtxV_EJJ7uu2zRO2C4mZ0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/GWThlWTtxV_EJJ7uu2zRO2C4mZ0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/5716280258965781227/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=5716280258965781227&amp;isPopup=true" title="35 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/5716280258965781227?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/5716280258965781227?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2008/10/how-to-disable-ssh-host-key-checking.html" title="How to disable SSH host key checking" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>35</thr:total></entry><entry gd:etag="W/&quot;D0YHQ30zfSp7ImA9WxRVFkw.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-606683255775940358</id><published>2008-09-27T18:28:00.000-07:00</published><updated>2008-11-13T14:25:32.385-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-13T14:25:32.385-08:00</app:edited><title>Upgrade individual packages for Debian-based systems</title><content type="html">If you are using Debian-based distributions (Debian, Ubuntu, etc), you are probably familiar with the &lt;span style="font-style:italic;"&gt;apt-get update&lt;/span&gt; followed by the &lt;span style="font-style:italic;"&gt;apt-get upgrade &lt;/span&gt;routine. That is what I regularly use to upgrade ALL packages that have an update available.&lt;br /&gt;&lt;br /&gt;But what if you only want to upgrade certain individual packages?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;apt-get upgrade&lt;/span&gt; will upgrade ALL or nothing.  So, that is out of the question.&lt;br /&gt;&lt;br /&gt;What you need is &lt;span style="font-style:italic;"&gt;apt-get install&lt;/span&gt;.  &lt;span style="font-style:italic;"&gt;apt-get install&lt;/span&gt; serves dual purposes: install and upgrade.  It installs a package if it is not already installed.  If it is already installed, &lt;span style="font-style:italic;"&gt;apt-get install&lt;/span&gt; will upgrade the package to the latest version.&lt;br /&gt;&lt;br /&gt;You should still run &lt;span style="font-style:italic;"&gt;apt-get update&lt;/span&gt; before &lt;span style="font-style:italic;"&gt;apt-get install&lt;/span&gt;.  You can specify one or more package names as arguments to the &lt;span style="font-style:italic;"&gt;apt-get install&lt;/span&gt; command.&lt;br /&gt;&lt;br /&gt;For example, to upgrade these 2 packages: libfreetype6, libtiff4: &lt;br /&gt;&lt;pre&gt;$ sudo apt-get update&lt;br /&gt;$ sudo apt-get install libfreetype6 libtiff4&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2008/09/upgrade-individual-packages-for-debian.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2008/09/upgrade-individual-packages-for-debian.html&amp;title=Upgrade%20individual%20packages%20for%20Debian-based%20systems"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-606683255775940358?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/N07oGWr9az0OC-Rms9F2roxFdeA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/N07oGWr9az0OC-Rms9F2roxFdeA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/N07oGWr9az0OC-Rms9F2roxFdeA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/N07oGWr9az0OC-Rms9F2roxFdeA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/606683255775940358/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=606683255775940358&amp;isPopup=true" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/606683255775940358?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/606683255775940358?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2008/09/upgrade-individual-packages-for-debian.html" title="Upgrade individual packages for Debian-based systems" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;D0YHQ30yeip7ImA9WxRVFkw.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-5927400319517598976</id><published>2008-09-21T21:37:00.000-07:00</published><updated>2008-11-13T14:25:32.392-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-13T14:25:32.392-08:00</app:edited><title>How to get the process start date and time</title><content type="html">How can we determine when a running process was started?&lt;br /&gt;&lt;br /&gt;The venerable &lt;span style="font-style:italic;"&gt;ps&lt;/span&gt; command deserves first consideration.&lt;br /&gt;&lt;br /&gt;Most Linux command-line users are familiar with either the standard UNIX notation or the BSD notation when it comes to specifying &lt;span style="font-style:italic;"&gt;ps&lt;/span&gt; options.&lt;br /&gt;&lt;br /&gt;If &lt;span style="font-style:italic;"&gt;ps -ef&lt;/span&gt; is what you use, that is the UNIX notation.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$ ps -ef&lt;br /&gt;UID     PID  PPID C STIME TTY      TIME CMD&lt;br /&gt;root      1    0  0 Sep20 ?    00:00:03 init [3]&lt;br /&gt;  &lt;sniped&gt;&lt;br /&gt;peter  1218    1  0 Sep20 ?    00:21:35 /usr/lib/iceweasel/firefox-bin -a firefox&lt;br /&gt;  &lt;sniped&gt;&lt;br /&gt;peter  4901    1  1 16:34 ?    00:01:12 /usr/bin/emacs-snapshot-gtk&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-style:italic;"&gt;STIME&lt;/span&gt; column displays the start time or date. From the above, we can tell that process 4901 (emacs) began execution at 16:34 (4:34 pm).  But on what day, today?&lt;br /&gt;&lt;br /&gt;From the &lt;span style="font-style:italic;"&gt;ps&lt;/span&gt; man page: 'Only the year will be displayed if the process was not started the same year &lt;span style="font-style:italic;"&gt;ps&lt;/span&gt; was invoked, or "mmmdd" if it was not started the same day, or "HH:MM" otherwise.'&lt;br /&gt;&lt;br /&gt;So, emacs was started at 16:34 TODAY.&lt;br /&gt;&lt;br /&gt;What is the start time for the other process, the firefox process with pid 1218?&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-style:italic;"&gt;STIME&lt;/span&gt; for process 1218 reads Sep20 (which was yesterday).  But what time yesterday?&lt;br /&gt;&lt;br /&gt;The default &lt;span style="font-style:italic;"&gt;ps -ef &lt;/span&gt;only tells you the start date but NOT the time if a process was NOT started on the same day.&lt;br /&gt;&lt;br /&gt;If the BSD notation is more familiar to you, you will find that &lt;span style="font-style:italic;"&gt;ps aux&lt;/span&gt; yields similar results.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$ ps aux&lt;br /&gt;USER       PID %CPU %MEM    VSZ   RSS TTY STAT START   TIME COMMAND&lt;br /&gt;root         1  0.0  0.1   1576   540 ?   Ss   Sep20   0:03 init[3]&lt;br /&gt;  &lt;sniped&gt;&lt;br /&gt;peter     1218  0.5  8.9 201252 45456 ?   Sl   Sep20  21:35 /usr/lib/iceweasel/firefox-bin -a firefox&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-style:italic;"&gt;Start&lt;/span&gt; column in the above output only reveals the start date if the process is older than the current day.&lt;br /&gt;&lt;br /&gt;There are (at least) 2 ways to determine the exact start time if the process was started before the current day.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Solution 1&lt;/span&gt;&lt;br /&gt;Specify elapsed time in the ps output format.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$ ps -eo pid,cmd,etime&lt;br /&gt;  PID CMD                             ELAPSED&lt;br /&gt; 1218 /usr/lib/iceweasel/firefox-bin -  2-16:04:45&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The above &lt;span style="font-style:italic;"&gt;ps&lt;/span&gt; command specifies 3 fields to be included in the output: the process &lt;span style="font-style:italic;"&gt;pid,&lt;/span&gt; the command, and the elapsed time, respectively.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;etime&lt;/span&gt; is the elapsed time since the process was started, in the form dd-hh:mm:ss. &lt;span style="font-style:italic;"&gt;dd&lt;/span&gt; is the number of days; &lt;span style="font-style:italic;"&gt;hh&lt;/span&gt;, the number of hours; &lt;span style="font-style:italic;"&gt;mm&lt;/span&gt;, the number of minutes; &lt;span style="font-style:italic;"&gt;ss&lt;/span&gt;, the number of seconds.&lt;br /&gt;&lt;br /&gt;The firefox command started execution 2 days, 16 hours, 4 minutes and 45 seconds ago. To find the exact time, you need to do some simple math. &lt;br /&gt;&lt;br /&gt;If you prefer the BSD notation, issue this command:&lt;br /&gt;&lt;pre&gt;$ ps axo pid,cmd,etime&lt;br /&gt;  PID CMD                             ELAPSED&lt;br /&gt;  &lt;sniped&gt;&lt;br /&gt; 1218 /usr/lib/iceweasel/firefox-bin -  2-16:04:57 &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Solution 2&lt;/span&gt;&lt;br /&gt;Get the process &lt;span style="font-style:italic;"&gt;pid&lt;/span&gt; and read off the timestamp in the corresponding subdirectory in &lt;span style="font-style:italic;"&gt;/proc&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;First, get the process &lt;span style="font-style:italic;"&gt;pid&lt;/span&gt; using the &lt;span style="font-style:italic;"&gt;ps&lt;/span&gt; command (&lt;span style="font-style:italic;"&gt;ps -ef&lt;/span&gt; or &lt;span style="font-style:italic;"&gt;ps aux&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;Then, use the &lt;span style="font-style:italic;"&gt;ls&lt;/span&gt; command to display the creation timestamp of the directory.&lt;br /&gt;&lt;pre&gt;$ ls -ld /proc/1218&lt;br /&gt;dr-xr-xr-x 5 peter peter 0 Sep 20 16:14 /proc/1218&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can tell from the timestamp that the process 1218 began executing on Sept 20, 16:14.&lt;br /&gt;&lt;br /&gt;If you can think of another clever way to get the start time and date, please let us know.&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2008/09/how-to-get-process-start-date-and-time.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2008/09/how-to-get-process-start-date-and-time.html&amp;title=How%20to%20get%20the%20process%20start%20date%20and%20time"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-5927400319517598976?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/DjtUG3z4K3o_0ewL72iVeNTzv7U/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/DjtUG3z4K3o_0ewL72iVeNTzv7U/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/DjtUG3z4K3o_0ewL72iVeNTzv7U/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/DjtUG3z4K3o_0ewL72iVeNTzv7U/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/5927400319517598976/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=5927400319517598976&amp;isPopup=true" title="9 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/5927400319517598976?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/5927400319517598976?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2008/09/how-to-get-process-start-date-and-time.html" title="How to get the process start date and time" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>9</thr:total></entry><entry gd:etag="W/&quot;D0YHQ3o4cSp7ImA9WxRVFkw.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-4046320383078009703</id><published>2008-09-02T20:00:00.001-07:00</published><updated>2008-11-13T14:25:32.439-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-13T14:25:32.439-08:00</app:edited><title>How to find and delete all hard links to a file</title><content type="html">Deleting a file is deceptively simple.  You can simply use the &lt;span style="font-style:italic;"&gt;rm&lt;/span&gt; command like this.&lt;br /&gt;&lt;pre&gt;$ rm file1&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;However, if the file has one or more &lt;a href="http://www.linfo.org/hard_link.html"&gt;hard links&lt;/a&gt; to it, life gets more interesting.  You need to seek and destroy all hard links to the file. &lt;br /&gt;&lt;br /&gt;A hard link is essentially another name for a file.  Hard links to &lt;span style="font-style:italic;"&gt;file1&lt;/span&gt; can be created as follows:&lt;br /&gt;&lt;pre&gt;$ ln file1 file2&lt;br /&gt;$ ln file1 tmp/file3&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;file2&lt;/span&gt; and &lt;span style="font-style:italic;"&gt;file3&lt;/span&gt; become another name of file1.&lt;br /&gt;&lt;br /&gt;How do I know if some file has a hard link to it?&lt;br&gt;&lt;br /&gt;Do a long listing of the file like this.&lt;br /&gt;&lt;pre&gt;$ ls -l file1&lt;br /&gt;-rw-r--r-- 3 peter peter 0 2008-09-01 16:15 file1&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note that the hard link count has the value 3 (this is the number to the left of the file owner). It means that the physical file has 3 names:  &lt;span style="font-style:italic;"&gt;file1&lt;/span&gt; and two others.&lt;br /&gt;&lt;br /&gt;If you only &lt;span style="font-style:italic;"&gt;rm file1&lt;/span&gt;, the other 2 names still exist, and users can still access the physical file using these 2 names.&lt;br /&gt;&lt;br /&gt;To find out all hard links to &lt;span style="font-style:italic;"&gt;file1&lt;/span&gt;, use this command.&lt;br /&gt;&lt;pre&gt;$ find /home -xdev -samefile file1&lt;br /&gt;/home/peter/file1&lt;br /&gt;/home/peter/tmp/file3&lt;br /&gt;/home/peter/file2&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note that we specified &lt;span style="font-style:italic;"&gt;/home&lt;/span&gt; as the search starting point.  You should replace &lt;span style="font-style:italic;"&gt;/home&lt;/span&gt; with the mount point for the filesystem in which your &lt;span style="font-style:italic;"&gt;file1&lt;/span&gt; was created.  (This is likely to be either &lt;span style="font-style:italic;"&gt;/home&lt;/span&gt; or / for files in your home directory.)&lt;br /&gt;&lt;br /&gt;The reason for using the filesystem's mount point is that hard links are restricted to reside in the same filesystem as the physical file. This means that &lt;span style="font-style:italic;"&gt;file2&lt;/span&gt; and &lt;span style="font-style:italic;"&gt;file3&lt;/span&gt; must be in the same filesystem as &lt;span style="font-style:italic;"&gt;file1&lt;/span&gt;.  Therefore, to find ALL hard links to a file, you must start search at the mount point of the filesystem.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-style:italic;"&gt;-xdev&lt;/span&gt; option instructs &lt;span style="font-style:italic;"&gt;find&lt;/span&gt; NOT to traverse directories in other filesystems.&lt;br /&gt;&lt;br /&gt;To find and delete all hard links to a file:&lt;br /&gt;&lt;pre&gt;$ find /home -xdev -samefile file1 | xargs rm&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;An alternative (and slightly more complicated) method is by using &lt;a href="http://www.linfo.org/inode.html" &gt;inodes&lt;/a&gt;.  An inode is a data structure assigned to a physical file that contains all its meta-information except the file's name(s).&lt;br /&gt;&lt;br /&gt;All hard links to a physical file share the same inode, and have the same inode id number.  Therefore, if you know the inode number of a file, you can find all hard links to the file by searching for files with the same inode number.&lt;br /&gt;&lt;br /&gt;To display a file's inode number, use &lt;span style="font-style:italic;"&gt;ls -i&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$ ls -li file1&lt;br /&gt;2655341 -rw-r--r-- 3 peter peter 0 2008-09-02 19:09 file1&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The first column in the above listing shows the file's inode number.&lt;br /&gt;&lt;br /&gt;Now that you know the inode number of &lt;span style="font-style:italic;"&gt;file1&lt;/span&gt;, you can use the &lt;span style="font-style:italic;"&gt;find&lt;/span&gt; command to search for all files that have the same inode number:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$ find /home -xdev -inum 2655341&lt;br /&gt;/home/peter/file1&lt;br /&gt;/home/peter/tmp/file3&lt;br /&gt;/home/peter/file2&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To delete all hard links to the physical file:&lt;br /&gt;&lt;pre&gt;$ find /home -xdev -inum 2655341 | xargs rm &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2008/09/how-to-find-and-delete-all-hard-links.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2008/09/how-to-find-and-delete-all-hard-links.html&amp;title=How%20to%20find%20and%20delete%20all%20hard%20links%20to%20a%20file"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-4046320383078009703?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Zliu0wrI2SC3ZJMc6tfQn1_-PLo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Zliu0wrI2SC3ZJMc6tfQn1_-PLo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Zliu0wrI2SC3ZJMc6tfQn1_-PLo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Zliu0wrI2SC3ZJMc6tfQn1_-PLo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/4046320383078009703/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=4046320383078009703&amp;isPopup=true" title="12 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/4046320383078009703?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/4046320383078009703?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2008/09/how-to-find-and-delete-all-hard-links.html" title="How to find and delete all hard links to a file" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>12</thr:total></entry><entry gd:etag="W/&quot;D0YHQ3ozcCp7ImA9WxRVFkw.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-7514527044921775054</id><published>2008-08-17T17:34:00.000-07:00</published><updated>2008-11-13T14:25:32.488-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-13T14:25:32.488-08:00</app:edited><title>How I repaired a corrupted grub menu.lst config file</title><content type="html">Imagine the shock when I discovered my Debian Etch machine would not boot after I ran a "routine" &lt;span style="font-style:italic;"&gt;apt-get upgrade&lt;/span&gt;. The upgrade involved quite a number of packages, including the kernel image.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.gnu.org/software/grub/manual/grub.html" &gt;GRUB&lt;/a&gt;, the default boot loader, came to an abrupt stop with the error message&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Error 15: File Not found&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;The culprit was the file &lt;span style="font-style:italic;"&gt;/[01;31mvmlinuz-[00m2.6.18-6-k7&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;The weird-looking file name suggested strongly that the &lt;span style="font-style:italic;"&gt;GRUB&lt;/span&gt; config file, &lt;span style="font-style:italic;"&gt;/boot/grub/menu.lst&lt;/span&gt;, got corrupted by the upgrade.&lt;br /&gt;&lt;br /&gt;At this point, I had the following options:&lt;br /&gt;&lt;ul&gt;  &lt;li&gt; Use a rescue CD/DVD like Knoppix to boot into the system, correct the &lt;span style="font-style:italic;"&gt;menu.lst&lt;/span&gt; file, and reboot. &lt;/li&gt;&lt;br /&gt;  &lt;li&gt; While in &lt;span style="font-style:italic;"&gt;GRUB,&lt;/span&gt; repair the corrupted pre-set &lt;span style="font-style:italic;"&gt;GRUB&lt;/span&gt; commands, boot up the system, then correct the &lt;span style="font-style:italic;"&gt;menu.lst&lt;/span&gt; file, and reboot. &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;I chose the second option.  Below was my experience, followed by some suggestions based on the hard lessons I learned.&lt;br /&gt;&lt;br /&gt;I rebooted the system.  At the &lt;span style="font-style:italic;"&gt;GRUB&lt;/span&gt; menu, I selected the corrupted OS entry, and typed &lt;span style="font-style:italic;"&gt;e&lt;/span&gt; to edit this entry's associated pre-set boot commands.  (Note that the OS entries and their associated commands are taken from the &lt;span style="font-style:italic;"&gt;menu.lst &lt;/span&gt;file.)&lt;br /&gt;&lt;br /&gt;The boot commands associated with the OS entry were:&lt;br /&gt;&lt;pre&gt;root  (hd0,0)&lt;br /&gt;kernel  /[01;31mvmlinuz-[00m2.6.18-6-k7 root=/dev/mapper/tiger-root ro &lt;br /&gt;savedefault&lt;/pre&gt;&lt;br /&gt;That did not look right because of the funny looking characters in the kernel command and the fact that the boot commands from before were &lt;span style="font-style:italic;"&gt;root,&lt;/span&gt; &lt;span style="font-style:italic;"&gt;kernel,&lt;/span&gt; and &lt;span style="font-style:italic;"&gt;initrd&lt;/span&gt;, but NOT &lt;span style="font-style:italic;"&gt;savedefault&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;ROOT&lt;br&gt;&lt;br /&gt;The &lt;span style="font-style:italic;"&gt;root&lt;/span&gt; command specifies and mounts GRUB's root drive and partition where the boot directory is located (&lt;span style="font-style:italic;"&gt;/boot&lt;/span&gt;).  This is usually &lt;span style="font-style:italic;"&gt;(hd0,0)&lt;/span&gt; which means the first partition of the first hard disk.  Note, GRUB's notation for numbering drives and partitions starts from 0, not 1.&lt;br /&gt;&lt;br /&gt;If you are not sure what to set the root drive, enter the GRUB batch command mode by pressing &lt;span style="font-style:italic;"&gt;b&lt;/span&gt;, and enter the following &lt;span style="font-style:italic;"&gt;find&lt;/span&gt; command.&lt;br /&gt;&lt;pre&gt;grub&gt; find /grub/stage1&lt;br /&gt;(hd0,0)&lt;/pre&gt;&lt;br /&gt;The &lt;span style="font-style:italic;"&gt;find&lt;/span&gt; command searches for the file named &lt;span style="font-style:italic;"&gt;grub/stage1&lt;/span&gt; and displays the root drive and partition which contains the file. Note that if the drive does not have a partition designated for &lt;span style="font-style:italic;"&gt;/boot&lt;/span&gt;, you need to prepend &lt;span style="font-style:italic;"&gt;/boot&lt;/span&gt; to the command argument (&lt;span style="font-style:italic;"&gt;find /boot/grub/stage1&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;So far so good: I did not have to modify the root drive. &lt;br /&gt;&lt;br /&gt;KERNEL&lt;br&gt;&lt;br /&gt;The &lt;span style="font-style:italic;"&gt;kernel&lt;/span&gt; command specifies and loads the Linux kernel image.  The default image file name was corrupted.  To correct, I selected the &lt;span style="font-style:italic;"&gt;kernel&lt;/span&gt; command, and pressed &lt;span style="font-style:italic;"&gt;e&lt;/span&gt; to edit the line. &lt;br /&gt;&lt;br /&gt;What should the file name be?   Different Linux distributions name the kernel image file differently.   Don't fret if you can't remember its name. The GRUB command line offers file name completion.  So just enter &lt;span style="font-style:italic;"&gt;kernel / &lt;/span&gt;and then hit &lt;span style="font-style:italic;"&gt;tab.&lt;/span&gt;&lt;br /&gt;grub&gt; kernel / &lt;br /&gt; Possible files are: System.map-2.6.18-6-k7 config-2.6.18-5-k7  config-2.6.18-6-k7  initrd.img-2.6.18-5-k7 vmlinuz-2.6.18-5-k7 grub  initrd.img-2.6.18-6-k7  System.map-2.6.18-5-k7  vmlinuz-2.6.18-6-k7&lt;br /&gt;&lt;br /&gt;For Debian, Ubuntu, Fedora, and Mandriva, the kernel image file is named &lt;span style="font-style:italic;"&gt;vmlinuz&lt;/span&gt; followed by the kernel release number and the machine architecture (e.g., &lt;span style="font-style:italic;"&gt;vmlinuz-2.6.18-6-k7&lt;/span&gt;). From the options returned by the file name completion feature, choose the kernel image with the latest release number.&lt;br /&gt;&lt;br /&gt;The rest of the kernel parameters looked OK, and required no change.&lt;br /&gt;&lt;pre&gt;grub&gt; kernel /vmlinuz-2.6.18-6-k7 root=/dev/mapper/tiger-root ro&lt;/pre&gt; &lt;br /&gt;INITRD&lt;br&gt;&lt;br /&gt;Next, I had to replace the &lt;span style="font-style:italic;"&gt;savedefault&lt;/span&gt; command with the &lt;span style="font-style:italic;"&gt;initrd&lt;/span&gt; command.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;initrd&lt;/span&gt; specifies the ramdisk image file.  The RAM disk is used for loading modules required to access the root filesystem. &lt;br /&gt;&lt;br /&gt;I first selected the &lt;span style="font-style:italic;"&gt;savedefault&lt;/span&gt; command and pressed &lt;span style="font-style:italic;"&gt;e&lt;/span&gt; to edit the line.  Again, you could use the &lt;span style="font-style:italic;"&gt;Tab&lt;/span&gt; key to help you complete the filename for the RAM disk file.&lt;br /&gt;&lt;pre&gt;grub&gt; initrd   /initrd.img-2.6.18-6-k7 &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Boot &amp; Edit menu.lst &lt;br&gt;&lt;br /&gt;After I made the above changes, I went back to the GRUB main menu, and pressed &lt;span style="font-style:italic;"&gt;b&lt;/span&gt; to boot.&lt;br /&gt;&lt;br /&gt;This time, the machine booted up successfully, and everything worked just fine for me.&lt;br /&gt;&lt;br /&gt;I was not done however.  Unless I changed the source of the problem (the corrupted &lt;span style="font-style:italic;"&gt;menu.lst&lt;/span&gt;), the machine would come up with the same boot error in the next reboot.  So, as root, I opened the file &lt;span style="font-style:italic;"&gt;/boot/grub/menu.lst&lt;/span&gt; and edited the commands.&lt;br /&gt;&lt;br /&gt;Before I could modify the corrupted commands, I needed to first locate the corresponding OS entry in the file.   Each OS entry occupies a separate section in the file, beginning with its own title line.  So, I scrolled down the file until I reached the target title line.&lt;br /&gt;&lt;pre&gt;title Debian GNU/Linux, kernel [01;31m-[00m2.6.18-6-k7&lt;br /&gt;root (hd0,0)&lt;br /&gt;kernel /[01;31mvmlinuz-[00m2.6.18-6-k7 root=/dev/mapper/tiger-root ro &lt;br /&gt;savedefault&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;After correcting the commands, save the file, and reboot the machine.&lt;br /&gt;&lt;br /&gt;Lessons Learned&lt;br&gt;&lt;br /&gt;The GRUB config file (&lt;span style="font-style:italic;"&gt;menu.lst&lt;/span&gt;) can get corrupted, and when it does, it spells real trouble.&lt;br /&gt;&lt;br /&gt;The commands to boot the OS are not something anyone tends to remember.  So, it makes sense to have a print out of the &lt;span style="font-style:italic;"&gt;menu.lst&lt;/span&gt; file or a backup copy. &lt;br /&gt;&lt;br /&gt;What I do is backup the &lt;span style="font-style:italic;"&gt;menu.lst&lt;/span&gt; file in the same directory as &lt;span style="font-style:italic;"&gt;menu.lst&lt;/span&gt; (say, call it &lt;span style="font-style:italic;"&gt;menu.lst.bak&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;The advantage of saving it in the same directory (as opposed to somewhere over the network) is that if the &lt;span style="font-style:italic;"&gt;menu.lst&lt;/span&gt; file ever gets corrupted again, you can still display the backup copy at the grub command prompt.   During the GRUB boot up process, you can display the backup file by simply entering the following at the GRUB command prompt.&lt;br /&gt;&lt;pre&gt; grub&gt; cat /grub/menu.lst.bak &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The above &lt;span style="font-style:italic;"&gt;cat&lt;/span&gt; command displays the backup &lt;span style="font-style:italic;"&gt;menu.lst&lt;/span&gt; file.  Armed with the knowledge of the correct commands to use, you can then edit the commands as shown in this article.&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2008/08/how-i-repaired-corrupted-grub-menulst.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2008/08/how-i-repaired-corrupted-grub-menulst.html&amp;title=How%20I%20repaired%20a%20corrupted%20grub%20config%20file%20menu.lst "&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-7514527044921775054?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/bUO2LbRELs5Cax300_JwlOMhuX0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/bUO2LbRELs5Cax300_JwlOMhuX0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/bUO2LbRELs5Cax300_JwlOMhuX0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/bUO2LbRELs5Cax300_JwlOMhuX0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/7514527044921775054/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=7514527044921775054&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/7514527044921775054?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/7514527044921775054?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2008/08/how-i-repaired-corrupted-grub-menulst.html" title="How I repaired a corrupted grub menu.lst config file" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;D0YHQ3s4cSp7ImA9WxRVFkw.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-7439577083791505603</id><published>2008-08-09T11:06:00.001-07:00</published><updated>2008-11-13T14:25:32.539-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-13T14:25:32.539-08:00</app:edited><title>How to show apt log history</title><content type="html">Users of Debian-based distributions (myself included) often brag about Debian's supposedly superior package management tool-set.  This tool-set includes a choice of several excellent package managers such as &lt;span style="font-style:italic;"&gt;dpkg&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;apt&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;synaptic&lt;/span&gt;, and &lt;span style="font-style:italic;"&gt;aptitude&lt;/span&gt;.   The various tools are all first class at what they are designed to do.&lt;br /&gt;&lt;br /&gt;In my opinion, one major feature gap is a command-line interface for viewing the &lt;span style="font-style:italic;"&gt;apt&lt;/span&gt; change log.  After a recent routine Etch package upgrade, I discovered that the grub &lt;span style="font-style:italic;"&gt;menu.lst&lt;/span&gt; file got corrupted. So, I wanted to check the recent &lt;span style="font-style:italic;"&gt;apt&lt;/span&gt; activities to find out which packages were the possible suspects.&lt;br /&gt;&lt;br /&gt;A google search revealed that viewing change history is not that simple.  &lt;span style="font-style:italic;"&gt;Aptitude&lt;/span&gt; writes change log info to &lt;span style="font-style:italic;"&gt;/var/log/aptitude&lt;/span&gt;. &lt;span style="font-style:italic;"&gt;Synaptic&lt;/span&gt; users can get the same info through its graphical user interface.    But is there a standard change log file that the most common Debian package managers write to?  The second question is whether there exists a command-line tool for accessing it. &lt;br /&gt;&lt;br /&gt;It turns out that such a log exists, and it is &lt;span style="font-style:italic;"&gt;/var/log/dpkg.log&lt;/span&gt;.   This is a single log file that records all the &lt;span style="font-style:italic;"&gt;apt&lt;/span&gt; activities, such as installs or upgrades, for the various package managers (&lt;span style="font-style:italic;"&gt;dpkg&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;apt-get&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;synaptic&lt;/span&gt;, &lt;span style="font-style:italic;"&gt;aptitude&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;Regarding a command-line tool for accessing &lt;span style="font-style:italic;"&gt;apt&lt;/span&gt; history, there used to be a package named &lt;span style="font-style:italic;"&gt;apt-history&lt;/span&gt; for viewing &lt;span style="font-style:italic;"&gt;apt-get&lt;/span&gt; activities. Its &lt;a href="http://redclay.altervista.org/wiki/doku.php?id=projects:old-projects" &gt;web site&lt;/a&gt; suggests that work in the project has been discontinued due to the fact that &lt;span style="font-style:italic;"&gt;dpkg&lt;/span&gt; now does logging. It went on to recommend the use of a simple bash function (also named &lt;span style="font-style:italic;"&gt;apt-history&lt;/span&gt;) to access the log file (&lt;span style="font-style:italic;"&gt;/var/log/dpkg.log&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;Below is the bash function from that web site.&lt;br /&gt;&lt;pre&gt;function apt-history(){&lt;br /&gt;      case "$1" in&lt;br /&gt;        install)&lt;br /&gt;              cat /var/log/dpkg.log | grep 'install '&lt;br /&gt;              ;;&lt;br /&gt;        upgrade|remove)&lt;br /&gt;              cat /var/log/dpkg.log | grep $1&lt;br /&gt;              ;;&lt;br /&gt;        rollback)&lt;br /&gt;              cat /var/log/dpkg.log | grep upgrade | \&lt;br /&gt;                  grep "$2" -A10000000 | \&lt;br /&gt;                  grep "$3" -B10000000 | \&lt;br /&gt;                  awk '{print $4"="$5}'&lt;br /&gt;              ;;&lt;br /&gt;        *)&lt;br /&gt;              cat /var/log/dpkg.log&lt;br /&gt;              ;;&lt;br /&gt;      esac&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I've tried it, and it works.&lt;br /&gt;&lt;br /&gt;To set it up, insert the above code into &lt;span style="font-style:italic;"&gt;/root/.bashrc&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;To run &lt;span style="font-style:italic;"&gt;apt-history&lt;/span&gt;, you need to become &lt;span style="font-style:italic;"&gt;root&lt;/span&gt; (for example, &lt;span style="font-style:italic;"&gt;sudo -i&lt;/span&gt;).  Entering &lt;span style="font-style:italic;"&gt;apt-history&lt;/span&gt; with no parameter will simply dump the change log file. To select what activities you want to see, you can enter one of &lt;span style="font-style:italic;"&gt;install, upgrade, remove, rollback&lt;/span&gt; as a single parameter to &lt;span style="font-style:italic;"&gt;apt-history&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$ sudo -i&lt;br /&gt;Password:&lt;br /&gt;# apt-history install&lt;br /&gt;2008-08-01 21:37:00 install googlizer &lt;none&gt; 0.3-3&lt;br /&gt;2008-08-09 08:20:54 install agrep &lt;none&gt; 4.17-3&lt;br /&gt;2008-08-09 08:28:26 install abuse-frabs &lt;none&gt; 2.10-7&lt;br /&gt;2008-08-09 08:28:27 install abuse &lt;none&gt; 1:0.7.0-5&lt;br /&gt;#&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html&amp;title=How%20to%20show%20apt%20log%20history"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-7439577083791505603?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/dBJX0RUdWZg3-JQnrmjbRuLXgH0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dBJX0RUdWZg3-JQnrmjbRuLXgH0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/dBJX0RUdWZg3-JQnrmjbRuLXgH0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dBJX0RUdWZg3-JQnrmjbRuLXgH0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/7439577083791505603/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=7439577083791505603&amp;isPopup=true" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/7439577083791505603?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/7439577083791505603?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html" title="How to show apt log history" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>4</thr:total></entry><entry gd:etag="W/&quot;D0YHQ3s_fyp7ImA9WxRVFkw.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-1301394577665063499</id><published>2008-08-04T13:55:00.000-07:00</published><updated>2008-11-13T14:25:32.547-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-13T14:25:32.547-08:00</app:edited><title>Learn more about a command when no man info page is available</title><content type="html">To read the documentation about a command, the first thing we do is to read its manual (&lt;span style="font-style:italic;"&gt;man&lt;/span&gt;) page.&lt;br /&gt;&lt;pre&gt;$ man cd&lt;br /&gt;No manual entry for cd&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;But what if no &lt;span style="font-style:italic;"&gt;man&lt;/span&gt; page is available for that command?&lt;br /&gt;&lt;br /&gt;This could be due to a number of different reasons.  For example, the Linux system was originally installed without any &lt;span style="font-style:italic;"&gt;man&lt;/span&gt; pages at all.  I worked with a Linux-based mobile gateway device that has 0 &lt;span style="font-style:italic;"&gt;man&lt;/span&gt; pages pre-installed.  This is to save disk space on a 1 GB Solid State Drive (SSD).  In most typical desktops or servers, &lt;span style="font-style:italic;"&gt;man&lt;/span&gt; pages are pre-installed.&lt;br /&gt;&lt;br /&gt;A &lt;span style="font-style:italic;"&gt;man&lt;/span&gt; page can be missing for a particular command because the administrator, for whatever reason, did not install the &lt;span style="font-style:italic;"&gt;man&lt;/span&gt; page for that command.  If that is the case, google is your best friend.  The challenge here is to narrow down the search to get to the &lt;span style="font-style:italic;"&gt;man&lt;/span&gt; page quickly.  &lt;br /&gt;&lt;br /&gt;There is yet another reason why there is no &lt;span style="font-style:italic;"&gt;man&lt;/span&gt; page for a command.  If it is a bash shell built-in command, it will NOT have its own &lt;span style="font-style:italic;"&gt;man&lt;/span&gt; page.  Documentation is still available but it is a bit harder to get to it.  It turns out that information about bash built-in commands can be found inside the bash &lt;span style="font-style:italic;"&gt;man&lt;/span&gt; page. You simply enter &lt;span style="font-style:italic;"&gt;man bash&lt;/span&gt;, and search for the SHELL BUILTIN COMMANDS section (using the command &lt;span style="font-style:italic;"&gt;/^SHELL BUILTIN&lt;/span&gt;).   Then scroll down until you reach the built-in command you are looking for.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$ man bash&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;How do you know if something is a bash built-in command in the first place?&lt;br /&gt;&lt;br /&gt;Use the &lt;span style="font-style:italic;"&gt;type&lt;/span&gt; command (another bash built-in).&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$ type cd&lt;br /&gt;cd is a shell builtin &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note that not all Linux distributions behave the same way when you &lt;span style="font-style:italic;"&gt;man&lt;/span&gt; a bash built-in command. Debian Etch, the distro I use at home, reports no &lt;span style="font-style:italic;"&gt;man&lt;/span&gt; page when you &lt;span style="font-style:italic;"&gt;man&lt;/span&gt; cd.  Some distributions, like the Red Hat-based Centos, will display the bash &lt;span style="font-style:italic;"&gt;man&lt;/span&gt; page.  In this case, you are one step ahead of the rest.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2008/08/learn-more-about-command-when-no-man.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2008/08/learn-more-about-command-when-no-man.html&amp;title=How%20to%20find%20out%20more%20about%20a%20command%20when%20no%20man%20info%20page%20is%20available"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-1301394577665063499?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/nBAUmCEYtyuK--Wq5C16OsEVBiE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nBAUmCEYtyuK--Wq5C16OsEVBiE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/nBAUmCEYtyuK--Wq5C16OsEVBiE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nBAUmCEYtyuK--Wq5C16OsEVBiE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/1301394577665063499/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=1301394577665063499&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/1301394577665063499?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/1301394577665063499?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2008/08/learn-more-about-command-when-no-man.html" title="Learn more about a command when no man info page is available" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;D0YHQns6eSp7ImA9WxRVFkw.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-5658443758627495964</id><published>2008-07-30T20:23:00.000-07:00</published><updated>2008-11-13T14:25:33.511-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-13T14:25:33.511-08:00</app:edited><title>Pondus: A personal weight management software</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_D7BpcWFofE4/SJEyDCVWkeI/AAAAAAAAADU/JjXPPppYbl4/s1600-h/DSCN1686.JPG"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_D7BpcWFofE4/SJEyDCVWkeI/AAAAAAAAADU/JjXPPppYbl4/s320/DSCN1686.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5229015670101283298" /&gt;&lt;/a&gt;&lt;br /&gt;A week after my return from a New England &amp; Canada cruise, I found myself busy searching for a personal weight management software.&lt;br /&gt;&lt;br /&gt;Why weight management?   See the chocolate dessert buffet pictures taken on board the Holland America Maasdam cruise ship.&lt;br /&gt;&lt;br /&gt;I came across &lt;a href="http://www.ephys.de/software/pondus/" &gt;pondus&lt;/a&gt;, a python program that is free and open-sourced.&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_D7BpcWFofE4/SJEy9vN10PI/AAAAAAAAADc/8twMeBfCUWY/s1600-h/DSCN1706.JPG"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_D7BpcWFofE4/SJEy9vN10PI/AAAAAAAAADc/8twMeBfCUWY/s200/DSCN1706.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5229016678581784818" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Pondus&lt;/span&gt; has a rather modest feature set: the ability to enter one's weight over time, and have it plotted in a chart. It does not have too many bells and whistles, but it is very simple to use.&lt;br /&gt;&lt;br /&gt; &lt;span style="font-style:italic;"&gt;Pondus&lt;/span&gt; is packaged with certain Debian releases (namely, Lenny and Sid).  So a simple &lt;span style="font-style:italic;"&gt;apt-get install pondus&lt;/span&gt; will put it on your system.  Because I run Debian Etch, I need to install it from source files.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_D7BpcWFofE4/SJEz8mB4zuI/AAAAAAAAADk/c-XFvon0ovY/s1600-h/emptypondus.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_D7BpcWFofE4/SJEz8mB4zuI/AAAAAAAAADk/c-XFvon0ovY/s200/emptypondus.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5229017758447488738" /&gt;&lt;/a&gt;&lt;br /&gt;I downloaded the source tar ball as well as the install instructions from &lt;a href="http://www.ephys.de/software/pondus/download.htm"&gt;here&lt;/a&gt;.   The instructions are straight-forward, and I installed &lt;span style="font-style:italic;"&gt;pondus&lt;/span&gt; without a glitch.&lt;br /&gt;&lt;br /&gt;To run &lt;span style="font-style:italic;"&gt;pondus,&lt;/span&gt; just type &lt;span style="font-style:italic;"&gt;pondus&lt;/span&gt; in the command line.  When you run  &lt;span style="font-style:italic;"&gt;pondus&lt;/span&gt; for the first time, it is not too terribly exciting .... because you have not entered any weight data.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_D7BpcWFofE4/SJE2EdltN7I/AAAAAAAAADs/DhuFqTyMUNY/s1600-h/pref.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_D7BpcWFofE4/SJE2EdltN7I/AAAAAAAAADs/DhuFqTyMUNY/s200/pref.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5229020092644014002" /&gt;&lt;/a&gt;Before you enter your weight, you should customize the unit of measure that &lt;span style="font-style:italic;"&gt;pondus&lt;/span&gt; will use(lbs versus kgs).    Click on the Tool icon (the one with the screwdriver and wrench) to bring up  &lt;span style="font-style:italic;"&gt;Preferences&lt;/span&gt;.  For me, I prefer pounds (that is the unit my scale uses). &lt;br /&gt;&lt;br /&gt;Now, let's enter some weight data, and draw a pretty chart.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_D7BpcWFofE4/SJKEqKv-JoI/AAAAAAAAAD0/vN78MIamKc4/s1600-h/addpondus.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_D7BpcWFofE4/SJKEqKv-JoI/AAAAAAAAAD0/vN78MIamKc4/s200/addpondus.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5229387977305499266" /&gt;&lt;/a&gt;To enter a weight, click on the Plus icon.&lt;br /&gt;&lt;br /&gt;To plot the data, click on the Chart icon.&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_D7BpcWFofE4/SJKI9MzmKXI/AAAAAAAAAD8/XeN8UR5lQcs/s1600-h/plotpondus.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_D7BpcWFofE4/SJKI9MzmKXI/AAAAAAAAAD8/XeN8UR5lQcs/s200/plotpondus.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5229392702321600882" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="font-style:italic;"&gt;Pondus&lt;/span&gt; has some additional useful features such as data import and export in CSV format, as well as the ability to save the chart in png or svg (2-dimensional vector graphics) format.&lt;br /&gt;&lt;br /&gt;An interesting feature is that you can set time-sensitive goals (aka, &lt;span style="font-style:italic;"&gt;Weight Planner&lt;/span&gt;).   For example, you can set a goal such as "weigh 180 lbs on August 15". This feature is disabled by default.  To enable it, bring up  &lt;span style="font-style:italic;"&gt;Preferences&lt;/span&gt; as above, and click &lt;span style="font-style:italic;"&gt;Use Weight Planner&lt;/span&gt; checkbox to select it, and choose whether to include the weight plan in your plots.   Note that this feature is not for everyone (do I really need yet another remainder of my shortcomings?)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Pondus&lt;/span&gt; is adequate for tracking my body weight. I'm still searching for software that can also track my blood pressure.  Won't it be perfect if a single software can manage both weight and blood pressure?&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2008/07/pondus-personal-weight-management.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2008/07/pondus-personal-weight-management.html&amp;title=Pondus:%20A%20personal%20weight%20management%20software"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-5658443758627495964?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/DPxpcssBmZVxKPEDg56k8jjvLqk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/DPxpcssBmZVxKPEDg56k8jjvLqk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/DPxpcssBmZVxKPEDg56k8jjvLqk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/DPxpcssBmZVxKPEDg56k8jjvLqk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/5658443758627495964/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=5658443758627495964&amp;isPopup=true" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/5658443758627495964?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/5658443758627495964?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2008/07/pondus-personal-weight-management.html" title="Pondus: A personal weight management software" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_D7BpcWFofE4/SJEyDCVWkeI/AAAAAAAAADU/JjXPPppYbl4/s72-c/DSCN1686.JPG" height="72" width="72" /><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;A0cMSX4yeCp7ImA9WxdbE08.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-7684155502485848330</id><published>2008-07-28T06:00:00.000-07:00</published><updated>2008-08-09T17:44:48.090-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-08-09T17:44:48.090-07:00</app:edited><title>How to do reverse DNS lookup</title><content type="html">Most people can better remember domain names, e.g., www.gnu.org, than their corresponding IP addresses, 199.232.41.10. (In this example, www.gnu.org is the home of the Free Software Foundation.)  We delegate the responsibility to machines, aka, the DNS servers, to resolve the domain names for us.&lt;br /&gt;&lt;br /&gt;Sometimes, we do need to manually lookup the IP address of a domain name.  You may already be familiar with the &lt;span style="font-style:italic;"&gt;nslookup&lt;/span&gt; command which is now deprecated. We use the &lt;span style="font-style:italic;"&gt;dig&lt;/span&gt; command to make DNS queries.&lt;br /&gt;&lt;pre&gt; $ dig +noall +answer www.gnu.org&lt;br /&gt;www.gnu.org.            67      IN      CNAME   gnu.org.&lt;br /&gt;gnu.org.                67      IN      A       199.232.41.10&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The IP address is displayed in the &lt;span style="font-style:italic;"&gt;A&lt;/span&gt; record, and is 199.232.41.10.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-style:italic;"&gt;+noall, +answer&lt;/span&gt; combination basically tells &lt;span style="font-style:italic;"&gt;dig&lt;/span&gt; to only report the answer of the DNS query and skip the rest of the output.&lt;br /&gt;&lt;br /&gt;You can also use the &lt;span style="font-style:italic;"&gt;dig&lt;/span&gt; command with the &lt;span style="font-style:italic;"&gt;-x&lt;/span&gt; option to do a reverse DNS lookup.  A reverse DNS lookup means you want to look up the domain and host name of an IP address.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt; $ dig +noall +answer -x 199.232.41.10&lt;br /&gt;10.41.232.199.in-addr.arpa. 36000 IN    CNAME   rev-c41-10.gnu.org.&lt;br /&gt;rev-c41-10.gnu.org.       300     IN      PTR     www.gnu.org.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-style:italic;"&gt;PTR&lt;/span&gt; record is the one that contains the domain host name.  The domain name is, as you expect, www.gnu.org.&lt;br /&gt;&lt;br /&gt;Note that &lt;span style="font-style:italic;"&gt;PTR&lt;/span&gt; records are not required for IP addresses.  If a PTR record is not defined for an IP address, you cannot do a remote DNS lookup.&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-7684155502485848330?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/FoFJ6IbPl2Pd4sNcE1DFd0686PE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FoFJ6IbPl2Pd4sNcE1DFd0686PE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/FoFJ6IbPl2Pd4sNcE1DFd0686PE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FoFJ6IbPl2Pd4sNcE1DFd0686PE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/7684155502485848330/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=7684155502485848330&amp;isPopup=true" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/7684155502485848330?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/7684155502485848330?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2008/07/how-to-do-reverse-dns-lookup.html" title="How to do reverse DNS lookup" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;D0YHQns8fSp7ImA9WxRVFkw.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-1057372147015949286</id><published>2008-07-18T13:32:00.001-07:00</published><updated>2008-11-13T14:25:33.575-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-13T14:25:33.575-08:00</app:edited><title>How to count number of files in a directory</title><content type="html">Now that I am back from vacation, I had to take care of some chores, like uploading the pictures taken with my digital camera.&lt;br /&gt;&lt;br /&gt;I stepped out during the long upload process (400+ pictures).  When I returned, it was already done.  To just make sure all pictures are now on the server, I wanted to count the number of files in the &lt;span style="font-style:italic;"&gt;targetdir&lt;/span&gt; directory.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$ ls -1 targetdir | wc -l&lt;br /&gt;454&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The above command reads &lt;span style="font-style:italic;"&gt;ls dash one&lt;/span&gt; piped to &lt;span style="font-style:italic;"&gt;wc dash letter l&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Note that if you had used &lt;span style="font-style:italic;"&gt;ls dash letter l&lt;/span&gt; instead, the count is one greater than the actual number of files.  This is because &lt;span style="font-style:italic;"&gt;ls dash letter l&lt;/span&gt; outputs an extra total line:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$ ls -1 targetdir &lt;br /&gt;total 529436&lt;br /&gt;-rw-r--r-- 1 peter peter  1510976 Jul 13  2008 DSCN1001.jpg&lt;br /&gt;....&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The above method will count symbolic links as well as subdirectories in &lt;span style="font-style:italic;"&gt;targetdir&lt;/span&gt; (but not recursively into subdirectories).&lt;br /&gt;&lt;br /&gt;If you want to exclude subdirectories, you need a heavier duty tool than &lt;span style="font-style:italic;"&gt;ls&lt;/span&gt;.&lt;br /&gt;&lt;pre&gt;$ find targetdir -type f  -maxdepth 1 | wc -l&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;-type f&lt;/span&gt; ensures that the &lt;span style="font-style:italic;"&gt;find&lt;/span&gt; command only returns regular files for counting (no subdirectories).   &lt;br /&gt;&lt;br /&gt;By default, the &lt;span style="font-style:italic;"&gt;find&lt;/span&gt; command traverses into subdirectories for searching.  &lt;span style="font-style:italic;"&gt;-maxdepth 1&lt;/span&gt; prevents &lt;span style="font-style:italic;"&gt;find&lt;/span&gt; from traversing into subdirectories.   If you do want to count files in the subdirectories, just remove &lt;span style="font-style:italic;"&gt;-maxdepth 1&lt;/span&gt; from the command line.&lt;br /&gt;&lt;br /&gt;Note that the &lt;span style="font-style:italic;"&gt;find&lt;/span&gt; command does NOT classify a symbolic link as a regular file.  Therefore, the above &lt;span style="font-style:italic;"&gt;find -type f&lt;/span&gt; command does not return symbolic links. As a result, the final count excludes all symbolic links.&lt;br /&gt;&lt;br /&gt;To include symbolic links, add the &lt;span style="font-style:italic;"&gt;-follow&lt;/span&gt; option to find.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;$ find targetdir -type f -follow  -maxdepth 1 | wc -l &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2008/07/how-to-count-number-of-files-in.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2008/07/how-to-count-number-of-files-in.html&amp;title=How%20to%20count%20number%20of%20files%20in%20a%20directory"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-1057372147015949286?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/lvWiUZA1aj2sa4xWqkCm5gEq9T8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lvWiUZA1aj2sa4xWqkCm5gEq9T8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/lvWiUZA1aj2sa4xWqkCm5gEq9T8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lvWiUZA1aj2sa4xWqkCm5gEq9T8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/1057372147015949286/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=1057372147015949286&amp;isPopup=true" title="18 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/1057372147015949286?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/1057372147015949286?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2008/07/how-to-count-number-of-files-in.html" title="How to count number of files in a directory" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s72-c/small_su_logo.png" height="72" width="72" /><thr:total>18</thr:total></entry><entry gd:etag="W/&quot;D0YHRX4_eip7ImA9WxRVFkw.&quot;"><id>tag:blogger.com,1999:blog-8032022811235182759.post-7904150361176712288</id><published>2008-06-21T16:26:00.000-07:00</published><updated>2008-11-13T14:25:34.042-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-13T14:25:34.042-08:00</app:edited><title>Dual pane Linux file managers: mc and emelfm</title><content type="html">I have been computing all my life without using a dual pane file manager until one day I decided that having one will greatly enhance my qualify of life.  What I had in mind was something that will make my life easier in the copying or moving of files from 1 directory to another.&lt;br /&gt;&lt;br /&gt;By dual pane (or twin-pane) file manager, I mean a file manager that displays two directories side by side (one active, one passive).  The term is confusing because often a dual pane file manager has a third pane that lets you enter commands to execute on the active directory.&lt;br /&gt;&lt;br /&gt;Staying true to my preference for Command Line Interface (CLI), I first tried &lt;a href="http://www.ibiblio.org/mc/" &gt;Midnight Commander&lt;/a&gt; (&lt;span style="font-style:italic;"&gt;mc&lt;/span&gt;). As advertised, &lt;span style="font-style:italic;"&gt;mc&lt;/span&gt; is a file manager that is loaded with features. What I am looking for though is modest: a file manager with 2 directory panes that will satisfy my very basic day-to-day file management needs.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_D7BpcWFofE4/SF2PqBvc17I/AAAAAAAAAC0/6vrgFLUeqdk/s1600-h/mcbefore.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_D7BpcWFofE4/SF2PqBvc17I/AAAAAAAAAC0/6vrgFLUeqdk/s200/mcbefore.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5214481895749638066" /&gt;&lt;/a&gt;I found myself customizing the look and feel of &lt;span style="font-style:italic;"&gt;mc&lt;/span&gt; in the early adoption stage.  The nostalgic white text on blue background had to go.&lt;br /&gt;&lt;br /&gt;You can run &lt;span style="font-style:italic;"&gt;mc&lt;/span&gt; with the &lt;span style="font-style:italic;"&gt;-b&lt;/span&gt; option to force black and white.&lt;br /&gt;&lt;code&gt;$ mc -b &lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If you don't want to go that far, you can customize the color used by editing the init file (&lt;span style="font-style:italic;"&gt;~/.mc/ini&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;I inserted the following lines into the &lt;span style="font-style:italic;"&gt;~/.mc/ini&lt;/span&gt; file.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;[Colors]&lt;br /&gt;base_color=lightgray,green:normal=green,default:selected=white,gray:marked=yellow,default:markselect=yellow,gray:directory=blue,default:executable=brightgreen,default:link=cyan,default:device=brightmagenta,default:special=lightgray,default:errors=red,default:reverse=green,default:gauge=green,default:input=white,gray:dnormal=green,gray:dfocus=brightgreen,gray:dhotnormal=cyan,gray:dhotfocus=brightcyan,gray:menu=green,default:menuhot=cyan,default:menusel=green,gray:menuhotsel=cyan,default:helpnormal=cyan,default:editnormal=green,default:editbold=blue,default:editmarked=gray,blue:stalelink=red,default&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;I also rearranged the panes so that they are placed horizontally (instead of vertically). You can interactively customize the placement using the &lt;span style="font-style:italic;"&gt;mc&lt;/span&gt; Options menu (when you are already in &lt;span style="font-style:italic;"&gt;mc&lt;/span&gt;).  Alternatively, you can edit the &lt;span style="font-style:italic;"&gt;~/.mc/ini&lt;/span&gt; file, and make sure that the following horizontal_split line appears in the [Midnight-Commander] section:&lt;br /&gt;&lt;code&gt;[Midnight-Commander]&lt;br /&gt;....&lt;br /&gt;horizontal_split=1&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_D7BpcWFofE4/SF2Qp_whe9I/AAAAAAAAAC8/XzNnuYoB7lg/s1600-h/mcafter.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_D7BpcWFofE4/SF2Qp_whe9I/AAAAAAAAAC8/XzNnuYoB7lg/s200/mcafter.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5214482994728893394" /&gt;&lt;/a&gt;My &lt;span style="font-style:italic;"&gt;mc&lt;/span&gt; window looked like this after the above customization.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Another major annoyance is that if you run &lt;span style="font-style:italic;"&gt;mc&lt;/span&gt; in a &lt;span style="font-style:italic;"&gt;Gnome&lt;/span&gt; window, you cannot use the &lt;span style="font-style:italic;"&gt;F10&lt;/span&gt; key to quit &lt;span style="font-style:italic;"&gt;mc&lt;/span&gt;.  It turns out that &lt;span style="font-style:italic;"&gt;F10&lt;/span&gt; is normally the key to access the menu-bar in &lt;span style="font-style:italic;"&gt;Gnome&lt;/span&gt;. To quit &lt;span style="font-style:italic;"&gt;mc&lt;/span&gt;, you use your mouse to click the Quit soft-key.&lt;br /&gt;&lt;br /&gt;If it bothers you as much as it bothered me, you might want to disable the standard &lt;span style="font-style:italic;"&gt;F10&lt;/span&gt; menu-bar shortcut key for &lt;span style="font-style:italic;"&gt;Gnome&lt;/span&gt;.  To do that:&lt;br /&gt;&lt;code&gt;$ gconftool-2 --set /apps/gnome-terminal/global/use_menu_accelerators  --type bool false&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;After giving it a good run for about 3 weeks, I gave up on &lt;span style="font-style:italic;"&gt;mc&lt;/span&gt;.   The determining factor was how &lt;span style="font-style:italic;"&gt;mc&lt;/span&gt; handles the &lt;span style="font-style:italic;"&gt;Tab&lt;/span&gt; key.&lt;br /&gt;&lt;br /&gt;Like other dual pane file managers, &lt;span style="font-style:italic;"&gt;mc&lt;/span&gt; has a third pane that acts as the command line input window.  However, the type of commands that will run in that window seems very limited. I tried commands such as &lt;span style="font-style:italic;"&gt;date, pwd, ls&lt;/span&gt;, but they all showed no output. The most annoying feature to me is the &lt;span style="font-style:italic;"&gt;Tab&lt;/span&gt; key.  I am used to tapping the &lt;span style="font-style:italic;"&gt;Tab&lt;/span&gt; key in a bash window for command completion.  If you hit &lt;span style="font-style:italic;"&gt;Tab&lt;/span&gt; while you are typing away in the &lt;span style="font-style:italic;"&gt;mc&lt;/span&gt;'s command line window, the effect is that &lt;span style="font-style:italic;"&gt;mc&lt;/span&gt; switches the active focus to the other pane.&lt;br /&gt;&lt;br /&gt;I won't be surprised if someone tells me there is a way to customize the handling of the &lt;span style="font-style:italic;"&gt;Tab&lt;/span&gt; key.  But, at that point in time, I concluded that I will look for some other file manager that requires less adjustment and customization.&lt;br /&gt;&lt;br /&gt;I first became aware of &lt;span style="font-style:italic;"&gt;emelfm&lt;/span&gt; because it is packaged with the Damn Small Linux (DSL) distribution.   I decided to take a look at it because if it is included in DSL, it should be simple enough to satisfy my modest needs.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_D7BpcWFofE4/SF2RDXsF3zI/AAAAAAAAADE/ERSds5aRbH4/s1600-h/emelfm.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_D7BpcWFofE4/SF2RDXsF3zI/AAAAAAAAADE/ERSds5aRbH4/s200/emelfm.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5214483430649487154" /&gt;&lt;/a&gt;&lt;span style="font-style:italic;"&gt;emelfm&lt;/span&gt; is a GUI-based double pane file manager.  It has a clean, simple, and intuitive UI.  It does the basic file copying and moving.  It also has some nice additional features such as the ability to set bookmarks and apply filters to filenames.&lt;br /&gt;&lt;br /&gt;One minor annoyance I find is when I try to copy a file in the active window to the same location.  Essentially, what I want to do is copy and paste a file (to a new name) in the same directory in the active pane.   I cannot use the &lt;span style="font-style:italic;"&gt;Copy&lt;/span&gt; button to do it because it will only copy the file to the other pane.  Instead, I need to enter the &lt;span style="font-style:italic;"&gt;cp&lt;/span&gt; command explicitly in &lt;span style="font-style:italic;"&gt;emelfm&lt;/span&gt;'s command line window to do the copy.&lt;br /&gt;&lt;br /&gt;[P. Evans pointed out that &lt;span style="font-style:italic;"&gt;emelfm&lt;/span&gt; has a &lt;span style="font-style:italic;"&gt;Clone&lt;/span&gt; plugin that copies a file to the same directory.  Click &lt;span style="font-style:italic;"&gt;Configure&lt;/span&gt; and then &lt;span style="font-style:italic;"&gt;Buttons.&lt;/span&gt;  Add a button and select the &lt;span style="font-style:italic;"&gt;Clone&lt;/span&gt; plugin.]&lt;br /&gt;&lt;br /&gt;Using the command line window in &lt;span style="font-style:italic;"&gt;emelfm&lt;/span&gt; turns out to be a pleasant experience (as compared to &lt;span style="font-style:italic;"&gt;mc&lt;/span&gt;).    Hitting the &lt;span style="font-style:italic;"&gt;Tab&lt;/span&gt; key will only switch the active pane if your mouse cursor is not in the command line window.  If the cursor is in the command line window, hitting the &lt;span style="font-style:italic;"&gt;Tab&lt;/span&gt; key does what I expect: command and filename completion.   The commands that did not work in &lt;span style="font-style:italic;"&gt;mc&lt;/span&gt; all worked well in &lt;span style="font-style:italic;"&gt;emelfm&lt;/span&gt; &lt;span style="font-style:italic;"&gt;(date, pwd, ls)&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;I have been happily using &lt;span style="font-style:italic;"&gt;emelfm&lt;/span&gt; since then.  There are other GUI-based dual pane file managers out there: e.g., &lt;a href="http://krusader.org/" &gt;Krusader&lt;/a&gt;, &lt;a href="http://doublecmd.sourceforge.net/site/eng/" &gt;Double Commander&lt;/a&gt;. I have not tried them. However, I do most file management on the CLI, and only occasionally use a GUI-based file manager to do file copying. As such, &lt;span style="font-style:italic;"&gt;emelfm&lt;/span&gt; satisfies my requirement for a GUI-based file manager.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://linuxcommando.blogspot.com/2008/06/dual-pane-linux-file-managers-mc-and.html';&lt;br /&gt;&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://www.stumbleupon.com/submit?url=http://linuxcommando.blogspot.com/2008/06/dual-pane-linux-file-managers-mc-and.html&amp;title=Dual%20pane%20Linux%20file%20managers:%20mc%20and%20emelfm"&gt;&lt;img border=0 src="http://1.bp.blogspot.com/_D7BpcWFofE4/RxbS0t-6rgI/AAAAAAAAABk/OmuyxqtHOao/s200/small_su_logo.png" alt="StumbleUpon Toolbar"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;script type="text/javascript"&gt;&lt;!--
google_ad_client = "pub-1640070864477148";
//728x90, created 11/11/07
google_ad_slot = "6009857287";
google_ad_width = 728;
google_ad_height = 90;
//--&gt;&lt;/script&gt;
&lt;script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;
&lt;/script&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8032022811235182759-7904150361176712288?l=linuxcommando.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/eih2lYfljJ2AbVtqXBz2poU2-b0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/eih2lYfljJ2AbVtqXBz2poU2-b0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/eih2lYfljJ2AbVtqXBz2poU2-b0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/eih2lYfljJ2AbVtqXBz2poU2-b0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://linuxcommando.blogspot.com/feeds/7904150361176712288/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8032022811235182759&amp;postID=7904150361176712288&amp;isPopup=true" title="11 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/7904150361176712288?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8032022811235182759/posts/default/7904150361176712288?v=2" /><link rel="alternate" type="text/html" href="http://linuxcommando.blogspot.com/2008/06/dual-pane-linux-file-managers-mc-and.html" title="Dual pane Linux file managers: mc and emelfm" /><author><name>Peter Leung</name><uri>http://www.blogger.com/profile/05589860210899238688</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="24" src="http://www3.telus.net/public/pleung01/Peter2004Portrait1.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_D7BpcWFofE4/SF2PqBvc17I/AAAAAAAAAC0/6vrgFLUeqdk/s72-c/mcbefore.jpg" height="72" width="72" /><thr:total>11</thr:total></entry></feed>

