<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss1full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns="http://purl.org/rss/1.0/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
<channel rdf:about="http://aplawrence.com//rss/fullLinux.rdf">
<title>Linux Site News at A.P.Lawrence.com</title>
<link>http://aplawrence.com/</link>
<description>
Linux feed at aplawrence.com: Thousands of articles, reviews, consultants listings, skills tests, opinion, how-to's for Unix, Linux and Mac OS X, networking, web site maintenance and more.. 
</description>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>6</sy:updateFrequency>
<sy:updateBase>2008-01-01T00:00+00:00</sy:updateBase>
<dc:language>en</dc:language>
<dc:publisher>A.P. Lawrence</dc:publisher>
<dc:rights>Copyright  A.P. Lawrence</dc:rights>
<dc:creator>A.P. Lawrence (mailto:rssfeeds@aplawrence.com)</dc:creator>
<dc:date>2014-11-14T05:05:10+00:00</dc:date>
<image rdf:resource="http://aplawrence.com/image21.gif">
</image>
<items>
<rdf:Seq>
<rdf:li rdf:resource="http://aplawrence.com/Basics/restrict_script_to_console.html" />
<rdf:li rdf:resource="http://aplawrence.com/Lighter/truth_about_linux.html" />
<rdf:li rdf:resource="http://aplawrence.com/Unixart/seven-layer-osi-cake.html" />
<rdf:li rdf:resource="http://aplawrence.com/Unixart/system_admin.html" />
<rdf:li rdf:resource="http://aplawrence.com/Basics/trapping_errors.html" />
<rdf:li rdf:resource="http://aplawrence.com/Basics/ps_and_grep.html" />
<rdf:li rdf:resource="http://aplawrence.com/Basics/tput_stty.html" />
<rdf:li rdf:resource="http://aplawrence.com/Basics/ping.html" />
</rdf:Seq>
</items>
<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rdf+xml" href="http://feeds.feedburner.com/aplawrence/DOLL" /><feedburner:info uri="aplawrence/doll" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><geo:lat>41.889582</geo:lat><geo:long>-70.894066</geo:long></channel>
<image rdf:about="http://aplawrence.com/image21.gif">
<title>A.P.Lawrence Logo</title>
<url>http://aplawrence.com/image21.gif</url>
<link>http://aplawrence.com</link>
</image>


<item rdf:about="http://aplawrence.com/Basics/restrict_script_to_console.html">
<title>Restrict script to console use  </title>
<description>Linux,Linux,MacOSX,MacOSX,Scripting,Shell,Unix 

2013/11/05&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;br /&gt;

&lt;p&gt;A customer asked for a way to prevent a certain shell script from execution by SSH - it apparently it is supposed to be run only at the console.&lt;/p&gt;
&lt;p&gt;One choice is to examine 'tty'. Something like this, perhaps:&lt;/p&gt;
&lt;pre&gt;
&lt;br /&gt;
#!/bin/bash
case `tty` in 
/dev/tty*) echo "ok";;
/dev/pts/*) echo "No";exit 0;
esac
echo "Will proceed"
&lt;br /&gt;
&lt;br /&gt;
&lt;/pre&gt;
&lt;p&gt;Or perhaps one of the SSH variables can be tested:&lt;/p&gt;

&lt;pre&gt;
&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash
test -n $SSH_CLIENT &amp;amp;&amp;amp; exit 1
echo "Will proceed"
&lt;br /&gt;
&lt;/pre&gt;
&lt;p&gt;However, that $SSH_CLIENT will not be set if you "su -" to another user after logging in with ssh, so you may need to use the more direct test.&lt;/p&gt;


&lt;p&gt;Comments: &lt;a href="http://aplawrence.com/cgi-bin/newcomm.pl?commenting=/Basics/restrict_script_to_console.html"&gt;Click Here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want to showcase your product to our audience? Check our &lt;a href="http://aplawrence.com/advert.html"&gt;advertising options.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;Many of the products and books I review are things I purchased for my own use.  Some were given to me specifically for the purpose of   reviewing them.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;b&gt;I resell or can earn commissions from the sale of some of these items.  Links within these pages may be affiliate links that pay me for referring you 
to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain.  If you have any question, please do feel free to contact me.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;
&lt;div style="font-size:80%"&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt; - &lt;/td&gt;
&lt;td&gt;&lt;a href="http://samepage.io?partner=683d6fe8b2973c7cc2a4ba099fd949be56d864fe"&gt;Samepage - Redefining how people create and share information&lt;/a&gt;&lt;/td&gt;
&lt;td&gt; - &lt;/td&gt;
&lt;td&gt;&lt;a href="http://aplawrence.com/Kerio"&gt;Kerio Mail Server, Firewall and more&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/aplawrence/DOLL?a=HTWxaxuBuK4:1R2sguRRb5Q:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/aplawrence/DOLL?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aplawrence/DOLL/~4/HTWxaxuBuK4" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/aplawrence/DOLL/~3/HTWxaxuBuK4/restrict_script_to_console.html</link>
<feedburner:origLink>http://aplawrence.com/Basics/restrict_script_to_console.html</feedburner:origLink></item>
<item rdf:about="http://aplawrence.com/Lighter/truth_about_linux.html">
<title>The truth about Linux  </title>
<description>Lighter,Linux 

2013/08/27&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;!-- PLACEAD --&gt;&lt;!-- BIG LEFT --&gt;
&lt;br /&gt;
&lt;br /&gt;

&lt;p&gt;Those who know me well know that I often recommend Linux for the mail servers that I sell and for any task where reliability and performance are important.  I've been doing so for many years, but now, as I get closer to the age where I will put all this behind me, perhaps it's time to come clean and be truthful.&lt;/p&gt;
&lt;p&gt;It's all a total crock.&lt;/p&gt;
&lt;p&gt;Oh, yes, running a Linux server does cost less and will be more reliable. Linux will usually outperform any alternative, also.  That's all certainly true.  However, you should never actually DO that.&lt;/p&gt;
&lt;h3&gt;Nobody wants reliable&lt;/h3&gt;
&lt;p&gt;Yes, not paying Microsoft licenses on top of your application licenses is nice, and sometimes it's nice to have better speed, and certainly you don't want your server crashing daily, but extreme reliability is never at the top of anyone's list.&lt;/p&gt;
&lt;p&gt;Oh, yes, it may APPEAR at or near the top of the list, but it's always a lie. What people really want is "easy".&lt;/p&gt;
&lt;p&gt;Of course "easy" can be hard to pin down.  I can't give you a firm definition in this context, but I can tell you that it definitely does NOT mean "efficient".  As we'll see shortly, nobody wants efficient - efficiency is not something that will ever appear on a project punch list unless it was jokingly put there by some wise guy bent on causing trouble.  No, "feature rich" is desirable, but "efficient" is not important.&lt;/p&gt;
&lt;p&gt;That "easy" and "feature rich" are factually at odds with one another should be obvious, but in fact they are often made to look as though they complement each other.  Feature rich and easy trump reliable a hundred times over.&lt;/p&gt;
&lt;p&gt;The boss wants easy and feature rich and pretty pie charts because that's what he or she was taught to want in Management School.  While the boss almost certainly did take a statistics class and is capable of understanding any reliability statistics offered, these numbers tend toward many decimal places and therefore eyes glaze over and heads nod.  Few things are more boring than reliability.&lt;/p&gt;
&lt;p&gt;The users don't want reliable.  Again, they want features and to never be asked to use their brains.  That many users may have invested a great deal of money obtaining an education that would prove that they CAN use their brains is an oddity:  none of them WANT to. Having lots of fun and utterly useless reports they can send to each other and schedule meetings to discuss is important. Reliability is not.&lt;/p&gt;
&lt;p&gt;The support staff definitely does not want reliable.  Jobs are at risk here!  Microsoft Windows has absolutely created more jobs than anyone from the Unix server era could ever had imagined!  Let's not screw that up with stupid Penguins!&lt;/p&gt;
&lt;h3&gt;Nobody wants performance&lt;/h3&gt;
&lt;p&gt;Oh, everyone will SAY they want this, of course.  Some may even believe it.
But reality is that there are too many hours in a working day and a fast, high performance system can leave people sitting there with nothing to do.  Obviously they don't want that: again, jobs are at risk.  Not that their supervisors would ever want to trim staff, of course, as their own  salaries always have at least some relation to the number of desks they oversee.&lt;/p&gt;
&lt;p&gt;And while support staff can wile away slack time playing computer games with their friends, they don't want performance because the longer a task like a backup takes to run, the more time there is for Call of Duty or whatever it is these types play now.&lt;/p&gt;
&lt;h3&gt;Nobody cares about cost&lt;/h3&gt;
&lt;p&gt;Of course cost figures into somebody's spreadsheet somewhere, but there is much more to it.  You see, high cost that can be justified with lots of feature rich stuff that will keep everyone busy sending reports, looking at pie charts and supporting it is good for everyone.&lt;/p&gt;
&lt;p&gt;It's good for the boss because it's bragging rights on the golf course if he or she owns the company and it is bragging rights on their resume if they are planning a move up or have carelessly diminished some figures at the bottom of the P&amp;amp;L and think that they may need to plan that move soon.&lt;/p&gt;
&lt;p&gt;It's good on the users resumes for similar reasons.  The more feature rich the app they use is, the more chance some other company is using it and that, my friend, is employment security. A resume that mentions Ubuntu server might be helpful to someone in support, but it would be odd and perhaps troubling in any other context.  Mentioning XP, Vista and Windows 8 is very useful, however.&lt;/p&gt;
&lt;p&gt;As to support, Linux is fine on their resumes, but being part of an eight person Microsoft Exchange support team is far, far better.&lt;/p&gt;
&lt;p&gt;So there it is.  The naked truth about Linux.  My advice, my HONEST advice, is to avoid it completely.&lt;/p&gt;


&lt;p&gt;Comments: &lt;a href="http://aplawrence.com/cgi-bin/newcomm.pl?commenting=/Lighter/truth_about_linux.html"&gt;Click Here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want to showcase your product to our audience? Check our &lt;a href="http://aplawrence.com/advert.html"&gt;advertising options.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;Many of the products and books I review are things I purchased for my own use.  Some were given to me specifically for the purpose of   reviewing them.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;b&gt;I resell or can earn commissions from the sale of some of these items.  Links within these pages may be affiliate links that pay me for referring you 
to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain.  If you have any question, please do feel free to contact me.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;
&lt;div style="font-size:80%"&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt; - &lt;/td&gt;
&lt;td&gt;&lt;a href="http://samepage.io?partner=683d6fe8b2973c7cc2a4ba099fd949be56d864fe"&gt;Samepage - Redefining how people create and share information&lt;/a&gt;&lt;/td&gt;
&lt;td&gt; - &lt;/td&gt;
&lt;td&gt;&lt;a href="http://aplawrence.com/Kerio"&gt;Kerio Mail Server, Firewall and more&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/aplawrence/DOLL?a=_ZQV_HE6bQo:p6gLvcX4KCg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/aplawrence/DOLL?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aplawrence/DOLL/~4/_ZQV_HE6bQo" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/aplawrence/DOLL/~3/_ZQV_HE6bQo/truth_about_linux.html</link>
<feedburner:origLink>http://aplawrence.com/Lighter/truth_about_linux.html</feedburner:origLink></item>
<item rdf:about="http://aplawrence.com/Unixart/seven-layer-osi-cake.html">
<title>The Seven Layer inedible OSI cake  </title>
<description>Lighter,Linux,MacOSX,Microsoft,TCP-IP 

2013/08/23&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;!-- PLACEAD --&gt;&lt;!-- BIG LEFT --&gt;
&lt;br /&gt;
&lt;br /&gt;


&lt;p&gt;I have always disliked the OSI model.  No offense to the folks at ISO (though using a jumble of your own acronym is, well, conceited), but I have my reasons.&lt;/p&gt;
&lt;p&gt;The first is that the damn thing is hellishly difficult to memorize.  I was given the mnemonic "A priest saw ten nuns doing pushups".   That's not very helpful.  There are &lt;a href="http://compnetworking.about.com/b/2004/12/06/osi-model-seven-layer-mnemomics-for-networking-students.htm"&gt;other mnemonics&lt;/a&gt;, but none of them are useful in any sense whatsoever,&lt;/p&gt;
&lt;p&gt;Yesterday (or perhaps earlier; time is nebulous in my world), a customer asked my why a vendor from whom he was attempting to buy a new switch was blubbering on about "Layer 2" as though that were important. &lt;/p&gt;
&lt;p&gt;  I became angry.  My feeling is that customers should send checks and keep their yaps shut, especially when it comes to questions like this.  Call me up and ask "How's the weather up there?" and I can, with some effort, answer pleasantly, but seriously: how is anyone expected to politely respond to questions about the OSI model?&lt;/p&gt;
&lt;p&gt;My wife, another hellishly demanding person, disagrees.  She expects me to respond to such bleating on the theory that this will keep checks arriving in our mailbox.  To keep marital harmony, I agreed to write up an explanation for my customer and I gratuitously offer it to you, complete stranger though you may be.&lt;/p&gt;
&lt;h3&gt;One: Physical Layer&lt;/h3&gt;
&lt;p&gt;This is another reason I detest OSI.  This layer defines the electrical and physical aspects of the data connection.  They toss that off lightly as though that were nothing at all, but in fact, unspeakable acts of cruelty happen right here.&lt;/p&gt;
&lt;p&gt;Here, at the physical layer, innocent new born packets are shoved out into a highway jammed with other packets.  Are these packets traveling in an orderly fashion, politely making way for the new born?  Not on ethernet they are not.  Screaming along at reckless speeds that can exceed billions of bits per second, 
new packets can be overrun by their feckless cousins and the resulting carnage is truly awful.  NO PACKET EVER SURVIVES A COLLISION LIKE THAT!&lt;/p&gt;
&lt;h3&gt;Two: Data Link Layer&lt;/h3&gt;
&lt;p&gt;Another disgusting layer only made necessary by the callous disregard of the Physical Layer.  Among other things, this layer has the responsibility of watching the carnage caused by injecting packets blindly as we learned above.&lt;/p&gt;
&lt;p&gt;This is, in fact the Layer 2 my customer asked about.  It is ugly.  That's all you need to know.&lt;/p&gt;
&lt;p&gt;Sigh.  My wife says that my customer may need to know more.  Very well: the salesman mentioned Layer 2 because somebody taught him that was a good way to make you think that you might need another layer and that other layer is more 
expensive, thereby making bigger checks flow to HIS mailbox.&lt;/p&gt;
&lt;p&gt;We talked about this.  For your needs, Layer 2 is enough.  Please leave it at that; I'm tired and have five more layers to explain.&lt;/p&gt;
&lt;h3&gt;Three: Network Layer&lt;/h3&gt;
&lt;p&gt;This is the bully of the OSI model.  Here we have a happy little packet, all shiny and bouncy, zipping along bothering nobody (unless the stupid physical layer throws a new born in front of it).  It runs into the network layer and its life can suddenly be changed forever.  This layer can say "Hey, you! Over here! Let me have a look at your papers, mister.  Aha, just as I thought: you are going to China!".  And then, with no sympathy what so ever, this young packet, usually barely out of childhood, can be thrown out to the Internet where it has to associate with really unsavory characters.  It's barbaric and heartless and yet another reason I hate OSI.&lt;/p&gt;
&lt;h3&gt;Four: Transport Layer&lt;/h3&gt;
&lt;p&gt;Nobody likes the transport layer.  As we have learned, the physical layer is a horribly uncaring parent. Dead packets are nothing to it, but higher layers do care about these poor things and the miracle of Engineering allows the 
transport layer to request the recreation of damaged packets.&lt;/p&gt;
&lt;p&gt;The physical layer often objects to this duplication of effort and will audibly snarl, but really: whose fault is it?  Yes, we are looking at you, physical layer.&lt;/p&gt;
&lt;h3&gt;Five: Session Layer&lt;/h3&gt;
&lt;p&gt;This is often described as the "connection" between computers as though two machines had reached out and are holding hands, smiling at each other.  The music fades and we move to a long shot of two computers living happily ever after.&lt;/p&gt;
&lt;p&gt;Nothing could be farther from the truth.  Computers have been taught to distrust  each other and will reject attempted connections most of the time.  Nowadays, most computers and firewalls are utterly rude about it: it would be like asking someone to dance and having them ignore you as though you were invisible and inaudible.  Why does the OSI model allow such insensitivity?  They hate love, apparently.&lt;/p&gt;
&lt;h3&gt;Six: Presentation Layer&lt;/h3&gt;
&lt;p&gt;Doesn't that put a pretty picture in your mind?  Perhaps you imagined a packet arriving at this layer and being immediately surrounded by attentive servants who pick out new clothes, fix the packets hair and apply makeup before it goes on to the the final stop.  In fact, this layer is more like forced re-education camps, where packets may be stripped of their original structure and repacked so that even their own mother wouldn't know them.  Why does this happen?  It's because the sending computer may be EBCDIC and the recipient may be ASCII.  Too lazy to learn each other's ways, these computers let the presentation layer do the dirty work.&lt;/p&gt;
&lt;p&gt;More and more packets are also asked to disguise themselves - this is called "encryption" which comes from a Greek word that supposedly means "hidden".  Utter nonsense: these packets aren't hidden, they are jumbled and obfuscated and it is the presentation layers job to figure out what they really should be.  This is not easy work, which is why the presentation layer is often in a bad mood.&lt;/p&gt;&lt;h3&gt;Seven: Application layer&lt;/h3&gt;
&lt;p&gt;This is where the poor packet, having survived the high speeds of the wires, having been shoved here and there, torn apart and reconstituted who knows how many times, finally reaches its destination.&lt;/p&gt;
&lt;p&gt;What happens then? Is there a ticker tape parade and heartfelt thanks from 
the computer it has reached?  No, my friends, there is not.  The poor packet is immediately gutted, stripped of its protective layers and tossed into the hungry maw of whatever application (mail, a webserver, whatever) it belongs to.&lt;/p&gt;
&lt;p&gt;That's it.  It dies there, unloved and unremembered.  I cannot abide the brutality of the OSI model!&lt;/p&gt;
&lt;h3&gt;Gory details&lt;/h3&gt;
&lt;p&gt;It is said that there is no honor among thieves and it is also true that there is no love lost between OSI layers.  As has been intimated above, these layers cooperate, but only grudgingly.  For example, when something is not understood  at the transport layer, a RST packet is sent.&lt;/p&gt;
&lt;p&gt;Nobody likes a RST packet.  This is the OSI equivalent of your dinner companion spitting food into a napkin and then handing it to you.  It's beyond rude; it is unconscionable.  &lt;/p&gt;
&lt;p&gt;There are lighter moments.  An "URG" package can be sent.  This is very much like marking a package "Handle with Care" in that it is a cause for great amusement by everything that sees it.  "Oh, you are urgent, are yea? Here, I know a shortcut", and the gullible packet is sent down the wrong way where it will become lost and confused and may never find its way home.&lt;/p&gt;
&lt;h3&gt;The future&lt;/h3&gt;
&lt;p&gt;In recent years, we have seen the development of super-conductivity.  While this technology has not yet reached the masses, rumors are that elements of the OSI model (specifically the "bully" layer explained above) plan to route packets into circular super-conductors where the poor things will loop endlessly.  This is an example of the fiendish sadism yet to come.&lt;/p&gt;
&lt;p&gt;In closing, I hope that you will join me in fighting against the OSI model.  I believe that we could develop a kinder, more gentle model if enough of us raised our voices in protest.&lt;/p&gt;
&lt;p&gt;Will you join me?&lt;/p&gt;


&lt;p&gt;Comments: &lt;a href="http://aplawrence.com/cgi-bin/newcomm.pl?commenting=/Unixart/seven-layer-osi-cake.html"&gt;Click Here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want to showcase your product to our audience? Check our &lt;a href="http://aplawrence.com/advert.html"&gt;advertising options.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;Many of the products and books I review are things I purchased for my own use.  Some were given to me specifically for the purpose of   reviewing them.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;b&gt;I resell or can earn commissions from the sale of some of these items.  Links within these pages may be affiliate links that pay me for referring you 
to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain.  If you have any question, please do feel free to contact me.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;
&lt;div style="font-size:80%"&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt; - &lt;/td&gt;
&lt;td&gt;&lt;a href="http://samepage.io?partner=683d6fe8b2973c7cc2a4ba099fd949be56d864fe"&gt;Samepage - Redefining how people create and share information&lt;/a&gt;&lt;/td&gt;
&lt;td&gt; - &lt;/td&gt;
&lt;td&gt;&lt;a href="http://aplawrence.com/Kerio"&gt;Kerio Mail Server, Firewall and more&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/aplawrence/DOLL?a=5b_UHyse2nQ:LAGV9UDdC8Q:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/aplawrence/DOLL?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aplawrence/DOLL/~4/5b_UHyse2nQ" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/aplawrence/DOLL/~3/5b_UHyse2nQ/seven-layer-osi-cake.html</link>
<feedburner:origLink>http://aplawrence.com/Unixart/seven-layer-osi-cake.html</feedburner:origLink></item>
<item rdf:about="http://aplawrence.com/Unixart/system_admin.html">
<title>Let's be serious about System Administration  </title>
<description>Employment,Linux,MacOSX,Microsoft 

2013/08/22&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;!-- PLACEAD --&gt;&lt;!-- BIG LEFT --&gt;
&lt;br /&gt;
&lt;br /&gt;

&lt;p&gt;Two days ago I wrote a bit of satire that pretended to be a &lt;a href="http://aplawrence.com/Lighter/sysadm_wanted.html"&gt;job posting for a System Administrator job&lt;/a&gt;.  It got mentioned on Reddit and that sent us a lot of traffic and a few comments, though &lt;a href="http://www.reddit.com/r/sysadmin/comments/1kt167/system_administrator_wanted_humor/"&gt;most of the comments were at Reddit&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;One comment noted "This is so close to reality that it is almost not funny anymore."  I agree, and as I explained in my own comment, the basis of everything I said was taken from real life: things that have happened to me or from conversations I've had with other people.&lt;/p&gt;
&lt;p&gt;For example, I have had someone insist that I had to be in two places at the same time.  Of course she didn't put it quite like that, but she did insist that I must go see two widely geographically separated customers, both of which had thorny sounding issues that might tie me up for many hours.  When I pointed out that I might not be able to do both, she simply kept insisting that I had to.  Of course I "had to" because she had promised both customers that they would see me that day.&lt;/p&gt;
&lt;p&gt;That the satire hit the mark is seen in that some people thought it was real.  The exaggerations do echo what seems to be a lack of respect for this kind of work.  Given the amount of responsibility the job carries, why is that true?&lt;/p&gt;&lt;h3&gt;No degree needed&lt;/h3&gt;
&lt;p&gt;According to Wikipedia,&lt;a href="http://en.wikipedia.org/wiki/System_administrator"&gt;only five schools offer graduate programs in system administration.&lt;/a&gt;. Although many more offer Information Technology or Computer Science degrees, those are often overkill for a sysadmin position: you don't need to know how to write N-way caching code to do this job!&lt;/p&gt;
&lt;p&gt;Indeed, ubiquitous computers have been here only a few decades, so many of the older folks doing this kind of work fell into it.  They knew a little about computers and as their company increased its complement, they became the "guy", which eventually formalized into some sort of title.  Those people sometimes get the least respect of all; &lt;a href="http://aplawrence.com/Opinion/missyouwhen.html"&gt;the company doesn't see them as a "professional"&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;It doesn't look hard&lt;/h3&gt;
&lt;p&gt;It is sometimes said that if the system administrator is doing their job well, they have nothing to do.  That's not entirely true: there will always be 
problems to deal with, but a good sysadmin is a bit like Smokey the Bear: they stamp out small fires that nobody notices so that they do not have to deal with major conflagrations.&lt;/p&gt;
&lt;p&gt;But there's more to it.  Much of the more visible (and time consuming) may involve user problems. To some eyes, this looks much like bringing your car to the mechanic: some mysterious thing under the hood isn't working, the grease stained guy in the blue shirt pulls a wrench out of his pocket and fixes it.  It's "blue collar" work, and while the reality is much different, that's what it may look like to upper management.&lt;/p&gt;
&lt;h3&gt;It doesn't look hard &lt;span style="font-family: Times, serif"&gt;II&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;People "fix" their own computer problems.  Everyone who uses a computer 
has probably fixed something, even if it was just adjusting a setting.  The 
sysadmin job may look like more of the same - it's something "anybody could do" - if they weren't tied up doing more important things!&lt;/p&gt;
&lt;p&gt;It probably doesn't help that sysadmins sometimes have to ask Google 
for help.  That knowing what to search for and knowing how to discard chaff in the results is a skill is irrelevant:  you didn't know how to fix it, so you looked it up.  Anyone could do that!&lt;/p&gt;

&lt;h3&gt;No tie needed&lt;/h3&gt;
&lt;p&gt;If the sysadmin is also charged with diving under desks or opening machines with a screwdriver, you are more likely to find them in jeans than a suit.&lt;/p&gt;
&lt;p&gt;Suit work gets respect.  Screwdriver work, even when what follows the unscrewing might require far more accumulated knowledge than many so-called "professional" jobs, does not get respect.&lt;/p&gt;
&lt;h3&gt;It doesn't seem critical&lt;/h3&gt;
&lt;p&gt;That may seem impossible to believe, but there is a certain amount of complacent disregard for the systems that really are the heart of most businesses today.  I think part of it is that computers are, after, just a tool.  In the minds of some, the real work takes place in their minds and the computer systems are nothing more than glorified screwdrivers.  Because they don't understand the technology that makes that screwdriver work, they tend to diminish its value.  Sure, there will be panic if the systems are not working, but the panic has its roots in the interference with THEIR work.  The sysadmin sees a downed server as a downed server, but the people who use that server see the down time as an impediment to their more important work.&lt;/p&gt;
&lt;p&gt;If the system gets no respect, either does the administrator.&lt;/p&gt;
&lt;p&gt;By the way, that Wikipedia article would make a good reference if you are a sysadmin and need to defend your value to a somewhat clueless boss.  You might iterate the duties you have and compare them to those listed there, but you might also point out this sentence from the "Skills" section:&lt;/p&gt;
&lt;pre&gt;
Perhaps the most important skill for a system administrator is
problem solving-frequently under various sorts of constraints
and stress.
&lt;/pre&gt;
&lt;p&gt;That's "knowledge work", not "screwdriver work". The stress is real and the constraints are real.  The skills are important, and worthy of good compensation.&lt;/p&gt;


&lt;p&gt;Comments: &lt;a href="http://aplawrence.com/cgi-bin/newcomm.pl?commenting=/Unixart/system_admin.html"&gt;Click Here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want to showcase your product to our audience? Check our &lt;a href="http://aplawrence.com/advert.html"&gt;advertising options.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;Many of the products and books I review are things I purchased for my own use.  Some were given to me specifically for the purpose of   reviewing them.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;b&gt;I resell or can earn commissions from the sale of some of these items.  Links within these pages may be affiliate links that pay me for referring you 
to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain.  If you have any question, please do feel free to contact me.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;
&lt;div style="font-size:80%"&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt; - &lt;/td&gt;
&lt;td&gt;&lt;a href="http://samepage.io?partner=683d6fe8b2973c7cc2a4ba099fd949be56d864fe"&gt;Samepage - Redefining how people create and share information&lt;/a&gt;&lt;/td&gt;
&lt;td&gt; - &lt;/td&gt;
&lt;td&gt;&lt;a href="http://aplawrence.com/Kerio"&gt;Kerio Mail Server, Firewall and more&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/aplawrence/DOLL?a=_oL4-LdHipk:TOiWlLpZgq4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/aplawrence/DOLL?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aplawrence/DOLL/~4/_oL4-LdHipk" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/aplawrence/DOLL/~3/_oL4-LdHipk/system_admin.html</link>
<feedburner:origLink>http://aplawrence.com/Unixart/system_admin.html</feedburner:origLink></item>
<item rdf:about="http://aplawrence.com/Basics/trapping_errors.html">
<title>Trapping errors in Bash  </title>
<description>Basics,Linux,Linux,MacOSX,MacOSX,Unix 

2013/08/19&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;!-- PLACEAD --&gt;&lt;!-- BIG LEFT --&gt;
&lt;br /&gt;
&lt;br /&gt;


&lt;p&gt;I want to begin with a warning.  The bash shell is really quite powerful 
and it is possible to do some amazingly difficult scripting using nothing more. &lt;/p&gt;
&lt;p&gt;If you have any doubt of that, reading Chris F. A. Johnson's &lt;a href="http://aplawrence.com/Books/shellscriptingrecipes.html"&gt;Shell Scripting Recipes: A Problem-Solution Approach&lt;/a&gt; would convince you.  If Chris can write crossword puzzles using shell scripts, there's probably not much that can't be done.&lt;/p&gt;
&lt;p&gt;That doesn't mean that you should.  Complex shell scripts can be very hard 
to understand, impossible to modify by anyone but a true expert and are 
not necessarily transportable. Those statements can be true for any 
computer language, but shell scripts often cannot be written clearly when they reach a certain level of complexity.&lt;/p&gt;
&lt;p&gt;The concepts demonstrated here don't reach that level, but I suspect that 
you'll see that they easily could.  If you want to dive in and push these 
ideas to the limit, you can certainly do so.  Just don't ask me to debug 
anything like that!&lt;/p&gt;
&lt;p&gt;With that in mind, let's trap some errors.&lt;/p&gt;
&lt;h3&gt;A simple trap&lt;/h3&gt;
&lt;p&gt;This is as simple as it gets:&lt;/p&gt;
&lt;pre&gt;
#!/bin/bash
trap 'echo Sorry, there was an error at line $LINENO' ERR
ls /etc/no_such_place_or_file 2&amp;gt;/dev/null
echo "foo"
ls /etc/no_such_place_or_file 2&amp;gt;/dev/null
&lt;/pre&gt;
&lt;p&gt;Upon invocation that will spit out:&lt;/p&gt;
&lt;pre&gt;
Sorry, there was an error at line 3
foo
Sorry, there was an error at line 5
&lt;/pre&gt;
&lt;p&gt;(Unless you have a file or directory named "/etc/no_such_place_or_file", of course)&lt;/p&gt;
&lt;p&gt;That's helpful. There is a slight problem, though: 
&lt;/p&gt;
&lt;pre&gt;
#!/bin/bash
trap 'echo Sorry, there was an error at line $LINENO' ERR
for x in 1 2 3 4 5
do
ls /$x/nosuchplace 2&amp;gt;/dev/null
ls /$x/someotherplace 2&amp;gt;/dev/null
done
&lt;/pre&gt;
&lt;p&gt;That always says the line number is the top of the loop&lt;/p&gt;
&lt;pre&gt;
Sorry, there was an error at line 3
Sorry, there was an error at line 3
Sorry, there was an error at line 3
...
&lt;/pre&gt;
&lt;p&gt;That's because any control structure (if, while, for, until, case) is seen as one multi-line command. There's no point to that example other than to show that.&lt;/p&gt;
&lt;p&gt;We can do something like:&lt;/p&gt;
&lt;pre&gt;
trap 'echo Sorry, there was an error at line $LINENO with $x' ERR
&lt;/pre&gt;
&lt;p&gt;and get:&lt;/p&gt;
&lt;pre&gt;
Sorry, there was an error at line 3 with 1
Sorry, there was an error at line 3 with 1
Sorry, there was an error at line 3 with 2
Sorry, there was an error at line 3 with 2
..
&lt;/pre&gt;
&lt;p&gt;Which is some help, but control structures will obfuscate your errors.&lt;/p&gt;

&lt;p&gt;We can get far more complicated:&lt;/p&gt;
&lt;pre&gt;
#!/bin/bash
function my_trap()
{
[ $1 -lt 15 ] &amp;amp;&amp;amp; echo bad bad line $1 error $2 with x at $x
[ $1 -ge 15 ] &amp;amp;&amp;amp; echo REALLY bad at line $1 error $2
}

trap 'my_trap ${LINENO} $? ' ERR

for x in 1 2 3 4 5
do
ls /$x/nosuchplace 2&amp;gt; /dev/null
done
echo foo

ls /100/foo 2&amp;gt;/dev/null
&lt;/pre&gt;
&lt;p&gt;Which should produce:&lt;/p&gt;`

&lt;pre&gt;
bad bad line 11 error 1 with x at 1
bad bad line 11 error 1 with x at 2
bad bad line 11 error 1 with x at 3
bad bad line 11 error 1 with x at 4
bad bad line 11 error 1 with x at 5
foo
REALLY bad at line 17 error 1
&lt;/pre&gt;
&lt;p&gt;Or, you can reset the trap:&lt;/p&gt;
&lt;pre&gt;
#!/bin/bash
function my_trap()
{
[ $1 -lt 15 ] &amp;amp;&amp;amp; echo bad bad line $1 error $2 with x at $x
[ $1 -ge 15 ] &amp;amp;&amp;amp; echo REALLY bad at line $1 error $2
}


trap 'my_trap ${LINENO} $? ' ERR
                     
for x in 1 2 3 4 5
do
ls /$x/nosuchplace 2&amp;gt; /dev/null
done
echo foo
trap 'echo Sorry, there was a somewhat important  error at line $LINENO ' ERR
ls /100/foo 2&gt;/dev/null
&lt;/pre&gt;
&lt;p&gt;Which yields:&lt;/p&gt;
&lt;pre&gt;
bad bad line 11 error 1 with x at 1
bad bad line 11 error 1 with x at 2
bad bad line 11 error 1 with x at 3
bad bad line 11 error 1 with x at 4
bad bad line 11 error 1 with x at 5
foo
Sorry, there was a somewhat important error at line 17
&lt;/pre&gt;
&lt;p&gt;What if you would rather bail out at the very first error?&lt;/p&gt;

&lt;p&gt;You could add a "set -e" at the top of your script.  That stops on 
any error, though, so a better way might be to add an "exit" in your 
trap function that is seen when and where you want it to be seen. &lt;/p&gt;
&lt;p&gt;Finally, traps aren't just for errors.&lt;/p&gt;
&lt;pre&gt;
trap "echo All Done" 0
trap OnExit EXIT INT TERM
&lt;/pre&gt;
&lt;p&gt;The bash man page has extensive (and quite complex) information about "trap" and all its gotchas.&lt;/p&gt;


&lt;p&gt;Comments: &lt;a href="http://aplawrence.com/cgi-bin/newcomm.pl?commenting=/Basics/trapping_errors.html"&gt;Click Here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want to showcase your product to our audience? Check our &lt;a href="http://aplawrence.com/advert.html"&gt;advertising options.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;Many of the products and books I review are things I purchased for my own use.  Some were given to me specifically for the purpose of   reviewing them.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;b&gt;I resell or can earn commissions from the sale of some of these items.  Links within these pages may be affiliate links that pay me for referring you 
to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain.  If you have any question, please do feel free to contact me.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;
&lt;div style="font-size:80%"&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt; - &lt;/td&gt;
&lt;td&gt;&lt;a href="http://samepage.io?partner=683d6fe8b2973c7cc2a4ba099fd949be56d864fe"&gt;Samepage - Redefining how people create and share information&lt;/a&gt;&lt;/td&gt;
&lt;td&gt; - &lt;/td&gt;
&lt;td&gt;&lt;a href="http://aplawrence.com/Kerio"&gt;Kerio Mail Server, Firewall and more&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/aplawrence/DOLL?a=zSEbm_Py-_g:RUnVwLrLKvw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/aplawrence/DOLL?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aplawrence/DOLL/~4/zSEbm_Py-_g" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/aplawrence/DOLL/~3/zSEbm_Py-_g/trapping_errors.html</link>
<feedburner:origLink>http://aplawrence.com/Basics/trapping_errors.html</feedburner:origLink></item>
<item rdf:about="http://aplawrence.com/Basics/ps_and_grep.html">
<title>'ps' and 'grep'  </title>
<description>Basics,Linux,Linux,MacOSX,MacOSX,Unix 

2013/08/16&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;!-- PLACEAD --&gt;&lt;!-- BIG LEFT --&gt;
&lt;br /&gt;
&lt;br /&gt;

&lt;p&gt;When faced with the task of finding something in "ps", old Unix hands will almost automatically type "ps -e | grep" and follow that with whatever they are looking for.  I can tell you that after so many years of doing that, it's almost reflexive.  We may know that there are other ways, but it's the old saying: walk too close to a habit and it will bite you.&lt;/p&gt;
&lt;p&gt;The good thing is that most of the time that habit just wags its tail and gives us what we want. Even when there 
is a playful little snap of the teeth accompanying the tail wagging, we're often doing that at the command line and can ignore any superfluous output.  It's when our grepping is buried in a script that the results may turn tragic.&lt;/p&gt;
&lt;p&gt;There are a LOT of things that can go wrong with "ps -e | grep".  I'll try to cover the most damaging things, but 
I might miss one or two.  If you take away nothing else from what follows, make it this: test scripts carefully and do not assume anything!&lt;/p&gt;
&lt;h3&gt;Some alternates&lt;/h3&gt;
&lt;p&gt;There are other ways to get processes matching some string.  For example, on Linux:&lt;/p&gt;

&lt;pre&gt;
# ps -C watcher
  PID TTY          TIME CMD
 9153 ?        00:00:00 watcher
# ps -C sshd 
  PID TTY          TIME CMD
 2246 ?        00:00:01 sshd
 5435 ?        00:00:00 sshd
 5577 ?        00:00:00 sshd
# pgrep -l sshd
2246 sshd
5435 sshd
5577 sshd
&lt;/pre&gt;
&lt;p&gt;But "-C" is different on Mac OS X:&lt;/p&gt;
&lt;pre&gt;
 ps -C sshd
ps: illegal argument: sshd
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
          [-g grp[,grp...]] [-u [uid,uid...]]
          [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
       ps [-L]
&lt;/pre&gt;
&lt;p&gt;OS X  ps has a -C flag, but it isn't for showing processes.  The "pgrep" will work, though.&lt;/p&gt;
&lt;p&gt;OS X has another little gotcha.&lt;/p&gt;
&lt;pre&gt;
$ ps -e |grep taskgated
 1403 ??         0:00.01 /usr/libexec/taskgated -s
 1432 ttys001    0:00.00 grep taskgated
&lt;/pre&gt;
&lt;p&gt;Most non-BSD Unix folk would have expected one line, not two.  To get that from OS X, add -c:&lt;/p&gt;
&lt;pre&gt;
$ ps -ec |grep taskgated
 1403 ??         0:00.01 taskgated
&lt;/pre&gt;
&lt;p&gt;There are other ways to get rid of unwanted lines. &lt;a href="http://www.faqs.org/faqs/unix-faq/faq/part3/"&gt;Section 3.10 of Unix - Frequently Asked Questions&lt;/a&gt; suggests&lt;/p&gt;
&lt;pre&gt;
 ps ux | awk '/name/ &amp;amp;&amp;amp; !/awk/ {print $2}'
&lt;/pre&gt;
&lt;p&gt;and you might see this:&lt;/p&gt;
&lt;pre&gt;
ps aux | grep something | grep -v grep
&lt;/pre&gt;
&lt;p&gt;This is a clever way (though harder to type):&lt;/p&gt;
&lt;pre&gt;
ps aux | grep [s]shd
&lt;/pre&gt;
&lt;p&gt;In case you don't see why it's because the "grep" line will contain "grep [s]shd" (with the brackets) which won't match what grep is looking for.&lt;/p&gt;
&lt;p&gt;But in all cases, watch your switches.  On Linux, for example:&lt;/p&gt;
&lt;pre&gt;
# ps a
  PID TTY      STAT   TIME COMMAND
 2833 hvc0     Ss+    0:00 /sbin/getty -8 38400 hvc0
 3257 pts/1    Ss     0:00 /bin/bash
 3271 pts/1    S      0:00 sudo su -
 3274 pts/1    S      0:00 su -
 3275 pts/1    S      0:03 -su
 5578 pts/0    Ss     0:00 -bash
 5584 pts/0    S+     0:00 screen -D -r
12201 pts/1    R+     0:00 ps a
# ps -a
  PID TTY          TIME CMD
 3271 pts/1    00:00:00 sudo
 3274 pts/1    00:00:00 su
 3275 pts/1    00:00:03 bash
 5584 pts/0    00:00:00 screen
12202 pts/1    00:00:00 ps
&lt;/pre&gt;
&lt;p&gt;Those would be identical on OS X!&lt;/p&gt;
&lt;p&gt;Before we get too deep into ps idiosyncrasies here, you may want to take a look at &lt;a href="http://aplawrence.com/Blog/B1011.html"&gt;I_WANT_A_BROKEN_PS&lt;/a&gt; and &lt;a href="http://aplawrence.com/Blog/B1012.html"&gt;How "ps" works and why&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Let's move on to  look at a scripting problem:&lt;/p&gt;
&lt;pre&gt;
#!/bin/bash
X=`ps -e | grep $1`
# -ec on Mac
echo $X
&lt;/pre&gt;
&lt;p&gt;Nothing wrong with that, right?  Look, it works:&lt;/p&gt;
&lt;pre&gt;
$ ./t.sh vim
1474 ttys001 0:00.00 /bin/bash ./t.sh vim 1475 ttys001 0:00.00 /bin/bash
./t.sh vim 1477 ttys001 0:00.00 grep vim 1462 ttys002 0:00.01 vim foops
&lt;/pre&gt;
&lt;p&gt;OK, what about this?&lt;/p&gt;
&lt;pre&gt;
$ ./t.sh taskgated
1480 aa ab bh dl ds dt ex me pj pt re sc t1 t2 tp tt xt zz 0:00.01 taskgated
&lt;/pre&gt;
&lt;p&gt;What's all that "aa ab bh" stuff?  Here, let's see if this helps:&lt;/p&gt;
&lt;pre&gt;
$ ls ??
aa	bh	ds	ex	pj	re	t1	tp	xt
ab	dl	dt	me	pt	sc	t2	tt	zz
&lt;/pre&gt;
&lt;p&gt;
You have to be careful with pulling in the output of "ps" and randomly echoing it. The "ps" lines for daemons will include a "?" in the controlling tty column, so if you did "x=`ps -e | grep whatever`", the returning line would have a "?" (on Mac OS X, two "??"). If your script then does "echo $x", the ? mark or marks will match one or two character file names that happen to be present in your current directory. As this is directory dependent, your script might appear to work correctly initially and then break later.&lt;/p&gt;
&lt;p&gt;You can get &lt;a href="http://askubuntu.com/questions/157075/why-does-ps-aux-grep-x-give-better-results-than-pgrep-x"&gt;unexpected results with "pgrep" too.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Another thing that can bite you is the width of the listing.  What you see with "ps" at command line is not necessarily what "grep" sees. &lt;/p&gt;
&lt;pre style="font-size:85%"&gt;
$ ps -e
# partial output
...
 1589 ??         0:00.01 /System/Library/Frameworks/CFNetwork.framework/Version
 1629 ??         0:00.23 /System/Library/CoreServices/System Events.app/Content
 1644 ??         0:00.39 /System/Library/Frameworks/CoreServices.framework/Fram
...
$ ps -e | grep .
...
 1589 ??         0:00.01 /System/Library/Frameworks/CFNetwork.framework/Versions/A/Support/cookied
 1629 ??         0:00.23 /System/Library/CoreServices/System Events.app/Contents/MacOS/System Events -psn_0_1069317
 1644 ??         0:00.48 /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/
  Versions/A/Support/mdworker -s mdworker -c MDSImporterWorker -m com.apple.mdworker.shared
...
&lt;/pre&gt;
&lt;p&gt;Without more instructions, "ps -e" stops at your terminal width.  When it is 
piped, it does not.  That could lead to more matches than you expected.&lt;/p&gt;



&lt;p&gt;Comments: &lt;a href="http://aplawrence.com/cgi-bin/newcomm.pl?commenting=/Basics/ps_and_grep.html"&gt;Click Here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want to showcase your product to our audience? Check our &lt;a href="http://aplawrence.com/advert.html"&gt;advertising options.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;Many of the products and books I review are things I purchased for my own use.  Some were given to me specifically for the purpose of   reviewing them.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;b&gt;I resell or can earn commissions from the sale of some of these items.  Links within these pages may be affiliate links that pay me for referring you 
to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain.  If you have any question, please do feel free to contact me.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;
&lt;div style="font-size:80%"&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt; - &lt;/td&gt;
&lt;td&gt;&lt;a href="http://samepage.io?partner=683d6fe8b2973c7cc2a4ba099fd949be56d864fe"&gt;Samepage - Redefining how people create and share information&lt;/a&gt;&lt;/td&gt;
&lt;td&gt; - &lt;/td&gt;
&lt;td&gt;&lt;a href="http://aplawrence.com/Kerio"&gt;Kerio Mail Server, Firewall and more&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/aplawrence/DOLL?a=7g5zXtdQxlk:m00C70phn6o:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/aplawrence/DOLL?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aplawrence/DOLL/~4/7g5zXtdQxlk" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/aplawrence/DOLL/~3/7g5zXtdQxlk/ps_and_grep.html</link>
<feedburner:origLink>http://aplawrence.com/Basics/ps_and_grep.html</feedburner:origLink></item>
<item rdf:about="http://aplawrence.com/Basics/tput_stty.html">
<title>tput and stty  </title>
<description>Basics,Linux,Linux,MacOSX,MacOSX,Terminals,Unix 

&lt;!-- PLACEAD --&gt;&lt;!-- BIG LEFT --&gt;

&lt;br /&gt;
&lt;br /&gt;2013/08/15&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;Both of these have to do with your terminal. Either can be informational (telling you something about 
your terminal settings) or active (changing something).  For example, "tput" can control the position of 
the screen cursor:&lt;/p&gt;

&lt;p&gt;Try this:&lt;/p&gt;
&lt;pre&gt;
tput clear
echo "hello world"
echo "Input please"
tput cuu1
tput cuu1
tput cuf1
tput cuf1
tput cuf1
tput cuf1
tput cuf1
tput cuf1
tput el
read akey
tput clear
echo Thanks
&lt;/pre&gt;
&lt;p&gt;You can look up the things you can do in
"man terminfo". For example, "tput clear" will clear the screen,
while "tput cols" will tell you how wide your terminal is. &lt;/p&gt;
&lt;p&gt;Another useful resource is &lt;a hef="http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x405.html"&gt;Colours and Cursor Movement With tput&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;On the other hand, stty controls things like "echo".  Let's say that you wanted 
to turn off character echo while reading a password.  You could do this:&lt;/p&gt;
&lt;pre&gt;
old=`stty -g`
stty -echo
read password
stty $old
&lt;/pre&gt;
&lt;p&gt;Why save the old stty settings?  It's so you can put them back to what they were.  If you just 
said "stty echo". you are assuming that's how it was previously set.  It might not be: if the script 
was called from an emacs session, echo would have been off and you would have turned it back on!&lt;/p&gt;

&lt;p&gt;You can set colors: &lt;a href="http://aplawrence.com/Linux/setting-colors.html"&gt;Using color in shell scripts (Linux, Mac OS X)&lt;/a&gt;, 
&lt;a href="https://groups.google.com/d/msg/comp.unix.sco.misc/SD46smD6Z6Y/qFw-kG60vDEJ"&gt;switch to a line drawing characer set&lt;/a&gt; and much more.&lt;/p&gt;
&lt;p&gt;A simple "stty sane" can often restore a garbled screen (see &lt;a href="http://aplawrence.com/SCOFAQ/FAQ_scotec8stuck.html"&gt;My screen is completely unreadable&lt;/a&gt; if that's not enough).&lt;/p&gt;
&lt;p&gt;You might also try "tput reset" and "tput init" (which may be indentica;l see "man tput").&lt;/p&gt;
&lt;p&gt;You can fix backspace confusion that comes up when telneting from Linux to SCO:&lt;/p&gt;
&lt;pre&gt;
   case $TERM in
        ""|unknown|dumb|dial*|tty|*ansi*)
            TERM=ansi
            ;;
        linux|xterm|rxvt)
            stty intr '^c'
            stty erase '^?'
            tput smpch
            ;;
    esac
    export TERM
&lt;/pre&gt;
&lt;p&gt;(From &lt;a href="https://groups.google.com/d/msg/comp.unix.sco.misc/e1yj3mEDY_w/UWTmFGsm8nUJ"&gt;Problem with backspace key when telnet from Linux&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;A common confusion for folks unfamiliar with SCO is that, by default, SCO systems set interrupt to the DELETE
key, not CTRL-C. If you find that unbearable, you can easily change
it; for example,&lt;/p&gt;
&lt;pre&gt;
 stty intr ^C
 
&lt;/pre&gt;
&lt;p&gt;will change your interrupt on Bourne or Korn shells. In this
example, you actually type CTRL-C; if you are in vi adding it to
your .profile, type CTRL-V and then CTRL-C&lt;/p&gt;
&lt;p&gt;This can also be added to .profile (or whatever startup file your
shell uses) or to /etc/profile.&lt;/p&gt;
&lt;p&gt;We'd use stty "hold-open" scripts to &lt;a href="http://aplawrence.com/SCOFAQ/FAQ_scotec7pflowcontrol.html"&gt;control settings on serial printers&lt;/a&gt; also.&lt;/p&gt;
&lt;p&gt;Flow control is also controlled by stty.  That's often needed for serial sevices, but even on virtual terminals you can pause output with Cntrl-S and (if stty ixany is set), restart it with any keystroke.&lt;/p&gt;
&lt;p&gt;Should you happen to be using a serial terminal for some reason, &lt;a href="http://linux.about.com/od/srl_howto/a/hwtsrl13t04.html"&gt;Linux Serial How-To&lt;/a&gt; may be helpful. Real serail terminal or not, "stty -a" will display its settings:&lt;/p&gt;
&lt;pre&gt;
$ stty -a
speed 9600 baud; 35 rows; 119 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
tony@Ant-echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
tony@Ant-extprocac:~$ 
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel iutf8
	-ignbrk brkint -inpck -ignpar -parmrk
oflags: opost onlcr -oxtabs -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
	-dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = &amp;lt;undef&amp;gt;;
	eol2 = &amp;lt;undef&amp;gt;; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
	min = 1; quit = ^\; reprint = ^R; start = ^Q; st
&lt;/pre&gt;
&lt;p&gt;The 9600 baud is meaningless unless you really are on serial.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://aplawrence.com/Unixart/serial.art.html"&gt;Serial Wiring and Communications for the Confused&lt;/a&gt; might also be useful if you find yourself dealing with some ancient serial system.&lt;/p&gt;


&lt;p&gt;See also &lt;a href="http://www.tldp.org/LDP/lpg/node129.html#SECTION009223000000000000000"&gt;Terminfo Capabilities&lt;/a&gt; and  &lt;a href="http://aplawrence.com/Unixart/termcap.html"&gt;Termcap and Terminfo&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;Comments: &lt;a href="http://aplawrence.com/cgi-bin/newcomm.pl?commenting=/Basics/tput_stty.html"&gt;Click Here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want to showcase your product to our audience? Check our &lt;a href="http://aplawrence.com/advert.html"&gt;advertising options.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;Many of the products and books I review are things I purchased for my own use.  Some were given to me specifically for the purpose of   reviewing them.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;b&gt;I resell or can earn commissions from the sale of some of these items.  Links within these pages may be affiliate links that pay me for referring you 
to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain.  If you have any question, please do feel free to contact me.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;
&lt;div style="font-size:80%"&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt; - &lt;/td&gt;
&lt;td&gt;&lt;a href="http://samepage.io?partner=683d6fe8b2973c7cc2a4ba099fd949be56d864fe"&gt;Samepage - Redefining how people create and share information&lt;/a&gt;&lt;/td&gt;
&lt;td&gt; - &lt;/td&gt;
&lt;td&gt;&lt;a href="http://aplawrence.com/Kerio"&gt;Kerio Mail Server, Firewall and more&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/aplawrence/DOLL?a=PICk7pWg9uk:YLK_z3JzlOg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/aplawrence/DOLL?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aplawrence/DOLL/~4/PICk7pWg9uk" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/aplawrence/DOLL/~3/PICk7pWg9uk/tput_stty.html</link>
<feedburner:origLink>http://aplawrence.com/Basics/tput_stty.html</feedburner:origLink></item>
<item rdf:about="http://aplawrence.com/Basics/ping.html">
<title>All about ping  </title>
<description>Basics,Linux,TCP-IP 

2013/08/09&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;!-- PLACEAD --&gt;&lt;!-- BIG LEFT --&gt;
&lt;br /&gt;
&lt;br /&gt;


&lt;p&gt;Ping is a very useful network diagnostic tool and is often the first thing we turn to when we have 
network issues.  While it's true that a successful "ping" doesn't necessarily mean that higher level 
connectivity is working, the lack of a ping response from something that should respond almost certainly 
indicates network problems or a downed host. Slow ping responses usually mean slow networks, so 
ping is a convenient way to get some idea of network latency and congestion too.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;It don't mean a thing if it ain't got that ping- Dirk Hart &lt;/i&gt;&lt;/p&gt;
&lt;p&gt;At that simple level ("ping somehost"), we can't go too far wrong.  The host responds or it doesn't, the speed of the response is what we expect or it isn't.  There could be missing or duplicated responses (see below) but most of 
the time it is pretty straight forward.&lt;/p&gt;
&lt;p&gt;Where we might get into trouble is when we want to alter pings behavior or aren't aware of its behavior.  For example, Windows folk are often confused because Unix/Linux pings don't stop automatically - by default they keep pinging until you interrupt them (Ctrl-C, DEL or whatever the INTERRUPT sequence is - use CTRL-\ if all else fails).&lt;/p&gt;
&lt;p&gt;Different systems can use very different flags for common functions:&lt;/p&gt;
&lt;pre&gt;
(Linux)
-w deadline Specify a timeout, in seconds, before ping exits  
-t ttl Set the IP Time to Live
(Mac OS X)
-t timeout  Specify a timeout, in seconds, before ping exits 
-m ttl  Set the IP Time To Live for outgoing packets
-T ttl  Set the IP Time To Live for multicasted packets. 
&lt;/pre&gt;
&lt;p&gt;You can see how that might get you in trouble! Read the man page - read it even if you think you know ping inside 
and out, because you may not.&lt;/p&gt;
&lt;h3&gt;What can I check if ping doesn't work at all?&lt;/h3&gt;
&lt;p&gt;(Also see &lt;a href="http://aplawrence.com/Basics/networktroubleshooting.html"&gt;A non-technical guide to understanding and fixing TCP/IP problems on a network&lt;/a&gt;.)&lt;/p&gt;
&lt;p&gt;Did you try "ping localhost"?  If you can't do that, you aren't going to 
ping anything else!&lt;/p&gt;
&lt;p&gt;First, are you sure that the address, netmask and broadcast are
correct? Your broadcast should be the inverse of of your netmask.
For example, if your ip address is 192.168.2.3 and your netmask is
255.255.255.0, your broadcast should be 192.168.2.255, but if the
netmask were 255.255.0.0, the broadcast would be 192.168.255.255.&lt;/p&gt;
&lt;p&gt;If the netmask does not match the netmask of the OTHER machines
on the network, you can have strange results like being able to
ping machine X but machine X can't ping you.&lt;/p&gt;
&lt;p&gt;Ping by ip address rather than name. If that works, your problem
is name resolution, not anything else.&lt;/p&gt;
&lt;p&gt;Are you sure your ip address is unique? Try pinging it from some
other machine with this one turned off- obviously you should get
nothing.&lt;/p&gt;
&lt;p&gt;If you are on the same network and are able to, check "arp -a" on the other machine.  Does it 
show the expected MAC address for the IP you are pinging from?  Does it have any arp entry?&lt;/p&gt;
&lt;p&gt;Do you have a physical connection? You should be seeing network
traffic on the lights of your nic if you are connected to a hub
(not with a switch- unless the traffic is broadcast or directed to
your ip specifically), and if you unplug the patch cord, the lights
at the hub or switch should go out- if they don't, obviously you
aren't plugged in where you think you are.&lt;/p&gt;
&lt;p&gt;Is your cable good? Swap it with a working system to check.&lt;/p&gt;
&lt;p&gt;Move the machine to another place on the network- maybe the
wiring is bad just here.&lt;/p&gt;
&lt;p&gt;Routes all look good? netstat -rn shows you. If you are seeing
unexpected routes, a rip enabled router may be feeding you bad
info. Turn off rip by killing the routed process and make sure it
doesn't restart by editing it out of /etc/tcp. Find the line that
reads "/etc/routed &amp;amp;" and put a "#" in front of it.&lt;/p&gt;
&lt;h3&gt;Ping is slow&lt;/h3&gt;
&lt;p&gt;DNS lookups might be at fault - try "ping -n" and see &lt;a href="http://aplawrence.com/SCOFAQ//FAQ_scotec4slow_ping.html"&gt;Ping is really slow&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;DUP ping&lt;/h3&gt;

&lt;p&gt;The "DUP" means that "ping" received two replies to one enquiry - the 
icmp_sequence number is duplicated.&lt;/p&gt;
&lt;p&gt;The Linux man page says:&lt;/p&gt;
&lt;pre&gt;
DUPLICATE AND DAMAGED PACKETS
       ping will report duplicate and damaged packets.
       Duplicate packets should never occur, and seem to be
       caused by  inappropriate  link-level  retransmissions.
       Duplicates  may occur in many situations and are rarely
       (if ever) a good sign, although the presence of low levels
       of duplicates may not always be cause for alarm.

       Damaged packets are obviously serious cause for alarm and
       often indicate broken  hardware  somewhere  in  the ping
       packet's path (in the network or in the hosts).
&lt;/pre&gt;
&lt;p&gt;This almost certainly means faulty or misconfigured equipment somewhere - for example a bad netmask setting can cause one or the other machine to be on the "wrong" subnet (whichever one is wrong).&lt;/p&gt;
&lt;p&gt;&lt;a href="http://slashzeroconf.wordpress.com/2008/04/29/duplicate-ping-error-with-network-bonding-driver-in-linux/"&gt;Bonding NICS&lt;/a&gt; can also cause this.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.codeblog.co.uk/2009/06/22/web-platforms/vmware-duplicate-ping-responses/"&gt;VMware has also caused this sort of DUP&lt;/a&gt; confusion, as have other virtualization products.&lt;/p&gt;

&lt;p&gt;An anonymous person sent this:&lt;/p&gt;
&lt;pre&gt;
I've also seen this on wireless networks. The node in
question is hardwired to a wireless bridge and being pinged
across the WLAN from the router. Note the long ping time of
the previous packet. The first three packets also dropped.

64 bytes from 192.168.11.6: icmp_seq=3 ttl=64 time=5.7 ms 
64 bytes from 192.168.11.6: icmp_seq=4 ttl=64 time=14.0 ms 
64 bytes from 192.168.11.6: icmp_seq=5 ttl=64 time=9.5 ms 
64 bytes from 192.168.11.6: icmp_seq=6 ttl=64 time=5.1 ms 
64 bytes from 192.168.11.6: icmp_seq=7 ttl=64 time=1.7 ms 
64 bytes from 192.168.11.6: icmp_seq=8 ttl=64 time=53.1 ms 
64 bytes from 192.168.11.6: icmp_seq=8 ttl=64 time=88.0 ms (DUP!) 
64 bytes from 192.168.11.6: icmp_seq=9 ttl=64 time=2.8 ms 
64 bytes from 192.168.11.6: icmp_seq=10 ttl=64 time=2.2 ms 
&lt;/pre&gt;
&lt;p&gt;Here's another &lt;a href="http://forums.whirlpool.net.au/archive/1074108"&gt;similar issue&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Pings out of order&lt;/h3&gt;
&lt;p&gt;You'd expect sequential responses normally:&lt;/p&gt;
&lt;pre&gt;
64 bytes from 96.126.98.231: icmp_seq=0 ttl=55 time=82.358 ms
64 bytes from 96.126.98.231: icmp_seq=1 ttl=55 time=81.264 ms
64 bytes from 96.126.98.231: icmp_seq=2 ttl=55 time=82.797 ms
64 bytes from 96.126.98.231: icmp_seq=3 ttl=55 time=81.718 ms
64 bytes from 96.126.98.231: icmp_seq=4 ttl=55 time=83.187 ms
&lt;/pre&gt;
&lt;p&gt;But (taken from &lt;a href="https://groups.google.com/d/msg/comp.unix.sco.misc/e6aReFffKb0/o5Iy46cGXpAJ"&gt;Curious pings on SCO&lt;/a&gt;) here's something different:&lt;/p&gt;
&lt;pre&gt;
64 bytes from kasseob4 (10.22.136.54): icmp_seq=3 ttl=62 time=40 ms
64 bytes from kasseob4 (10.22.136.54): icmp_seq=0 ttl=62 time=3080 ms
64 bytes from kasseob4 (10.22.136.54): icmp_seq=1 ttl=62 time=2080 ms
64 bytes from kasseob4 (10.22.136.54): icmp_seq=2 ttl=62 time=1090 ms
64 bytes from kasseob4 (10.22.136.54): icmp_seq=4 ttl=62 time=2240 ms
64 bytes from kasseob4 (10.22.136.54): icmp_seq=5 ttl=62 time=1240 ms
64 bytes from kasseob4 (10.22.136.54): icmp_seq=6 ttl=62 time=240 ms
64 bytes from kasseob4 (10.22.136.54): icmp_seq=7 ttl=62 time=2400 ms
64 bytes from kasseob4 (10.22.136.54): icmp_seq=8 ttl=62 time=1400 ms
64 bytes from kasseob4 (10.22.136.54): icmp_seq=9 ttl=62 time=400 ms
64 bytes from kasseob4 (10.22.136.54): icmp_seq=13 ttl=62 time=40 ms
64 bytes from kasseob4 (10.22.136.54): icmp_seq=10 ttl=62 time=3080 ms
64 bytes from kasseob4 (10.22.136.54): icmp_seq=11 ttl=62 time=2080 ms
64 bytes from kasseob4 (10.22.136.54): icmp_seq=12 ttl=62 time=1090 ms
64 bytes from kasseob4 (10.22.136.54): icmp_seq=14 ttl=62 time=820 ms
&lt;/pre&gt;
&lt;p&gt;The poster commented "The ping looks like a sinus curve, running in a loop."&lt;/p&gt;
&lt;p&gt;What happened there?&lt;/p&gt;
&lt;p&gt;You can read that thread for various interpretations (slow DNS, DNS caching, packet caching and more) but my guess is that some of the packets may have traveled over a lower speed link (load splitting) or took a network path that 
just took longer to respond (busy?). Out of order delivery isn't necessarily a problem (TCP/IP &lt;a href="http://en.wikipedia.org/wiki/Out-of-order_delivery"&gt;expects that to happen&lt;/a&gt;) though obviously a lot of it will slow things down.&lt;/p&gt;

&lt;h3&gt;Intermittent ping timeout&lt;/h3&gt;
&lt;p&gt;If you see a timeout in the middle of succesful pings, what happened?&lt;/p&gt;
&lt;p&gt;First, "ping" does have a default timeout and a very busy machine just might not have gotten around to responding in time.  Internet network congestion could also. Software could cause that: here is a case where &lt;a href="http://thwack.solarwinds.com/thread/34278"&gt;Symantec Endpoint Protection seemed to be at fault&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This case &lt;a href="http://www.techrepublic.com/forums/questions/intermittent-network-connection-problem-ping-timeout/"&gt;turned out to be IP conflicts&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;What if the other side deliberately doesn't respond to ping?&lt;/h3&gt;
&lt;p&gt;There are other tools, but &lt;a href="http://xmodulo.com/2013/01/how-to-install-tcpping-on-linux.html"&gt;tcpping&lt;/a&gt; is "ping-like". &lt;/p&gt;
&lt;p&gt;Nmap is another possibility; see &lt;a href="http://wiki.itadmins.net/doku.php?id=network:tcp_udp_ping"&gt;How to ping a TCP or UDP port with nmap&lt;/a&gt; and &lt;a href="http://nmap.org/nping/"&gt;nping&lt;/a&gt;..&lt;/p&gt;
&lt;p&gt;&lt;a href="http://backdrift.org/how-to-ping-a-tcp-port"&gt;hping&lt;/a&gt; is yet another.&lt;/p&gt;
&lt;h3&gt;Ping6&lt;/h3&gt;
&lt;p&gt;On this Ubuntu system, ping and ping 6 are obviously different:&lt;/p&gt;
&lt;pre&gt;
# ls -l /bin/ping*
-rwsr-xr-x 1 root root 34740 Nov  8  2011 /bin/ping
-rwsr-xr-x 1 root root 39116 Nov  8  2011 /bin/ping6
&lt;/pre&gt;
&lt;p&gt;But their man pages are identical.&lt;/p&gt;
&lt;p&gt;The OS X and BSD man page is different and includes this:&lt;/p&gt;
&lt;pre&gt;
     The ping6 utility is intentionally separate from ping(8).

     There have been many discussions on why we separate ping6 and
     ping(8).  Some people argued that it would be more convenient to
     uniform the ping command for both IPv4 and IPv6.  The followings
     are an answer to the request.

     From a developer's point of view: since the underling raw
     sockets API is totally different between IPv4 and IPv6,
     we would end up having two types of code base.  There would
     actually be less benefit to uniform the two commands into a
     single command from the developer's standpoint.

     From an operator's point of view: unlike ordinary network
     applications like remote login tools, we are usually aware of
     address family when using network management tools.  We do not
     just want to know the reachability to the host, but want to
     know the reachability to the host via a particular network pro-
     tocol such as IPv6.  Thus, even if we had a unified ping(8)
     command for both IPv4 and IPv6, we would usually type a -6 or
     -4 option (or something like those) to specify the particular
     address family.  This essentially means that we have two
     different commands.
&lt;/pre&gt;


&lt;h3&gt;Oddities&lt;/h3&gt;
&lt;p&gt;&lt;a href="http://stuff.mit.edu/afs/sipb/user/golem/tmp/ptunnel-0.61.orig/web/"&gt;Ping Tunnel - For those times when everything else is blocked.&lt;/a&gt;.&lt;/p&gt;






&lt;p&gt;Comments: &lt;a href="http://aplawrence.com/cgi-bin/newcomm.pl?commenting=/Basics/ping.html"&gt;Click Here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Want to showcase your product to our audience? Check our &lt;a href="http://aplawrence.com/advert.html"&gt;advertising options.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;Many of the products and books I review are things I purchased for my own use.  Some were given to me specifically for the purpose of   reviewing them.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;&lt;b&gt;I resell or can earn commissions from the sale of some of these items.  Links within these pages may be affiliate links that pay me for referring you 
to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain.  If you have any question, please do feel free to contact me.&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;
&lt;div style="font-size:80%"&gt;
&lt;table&gt;
&lt;tr&gt;
&lt;td&gt; - &lt;/td&gt;
&lt;td&gt;&lt;a href="http://samepage.io?partner=683d6fe8b2973c7cc2a4ba099fd949be56d864fe"&gt;Samepage - Redefining how people create and share information&lt;/a&gt;&lt;/td&gt;
&lt;td&gt; - &lt;/td&gt;
&lt;td&gt;&lt;a href="http://aplawrence.com/Kerio"&gt;Kerio Mail Server, Firewall and more&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/aplawrence/DOLL?a=N3YavXoxdFs:Dug-HN5BEyQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/aplawrence/DOLL?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/aplawrence/DOLL/~4/N3YavXoxdFs" height="1" width="1"/&gt;</description>
<link>http://feedproxy.google.com/~r/aplawrence/DOLL/~3/N3YavXoxdFs/ping.html</link>
<feedburner:origLink>http://aplawrence.com/Basics/ping.html</feedburner:origLink></item>
</rdf:RDF>
