<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: My 10 UNIX Command Line Mistakes</title> <atom:link href="http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Greywolf</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-179089</link> <dc:creator>Greywolf</dc:creator> <pubDate>Thu, 09 Feb 2012 21:18:46 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-179089</guid> <description>On a SunOS/Solaris box, or anything with dynamically linked critical programs [cp, cat, tar, sh], if /dev/zero or /usr/lib/crt0.so vanishes, you&#039;re screwed.  /dev/zero is especially insidious, because, in their infinite wisdom, they decided to make mknod a dynamically linked executable, so you can&#039;t even mknod it.</description> <content:encoded><![CDATA[<p>On a SunOS/Solaris box, or anything with dynamically linked critical programs [cp, cat, tar, sh], if /dev/zero or /usr/lib/crt0.so vanishes, you&#8217;re screwed.  /dev/zero is especially insidious, because, in their infinite wisdom, they decided to make mknod a dynamically linked executable, so you can&#8217;t even mknod it.</p> ]]></content:encoded> </item> <item><title>By: Michael Shigorin</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-179061</link> <dc:creator>Michael Shigorin</dc:creator> <pubDate>Tue, 07 Feb 2012 17:33:44 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-179061</guid> <description>Just try that (not exactly that command but you&#039;ll figure it out) in a virtual machine, then think of mmap&#039;ed files, open handles, cached filesystem metadata.
On the bright side, on Linux at least one can salvage a (wrongly) deleted file at times by knowing it is still open by a running process, SIGSTOPping that process just in case, examining /proc/THAT_PID/fd/ symlinks and cat(1) the contents of the needed one, conveniently marked as &quot;(deleted)&quot;, into a safe place.
I&#039;m not a kernel guy either, only fixed iso9660 perms back in 1999 or so for localhost :) but I know freebsd FUD when I see it, and if you failed to find a distro that works for you (like I did in 2001), don&#039;t blame &quot;linux&quot; for it -- it&#039;s just not professional in the first place.  Ну, не стоит уши под лапшу подставлять и дальше её тиражировать.
Back to topic: on Linux it might be safer to check /proc/mounts and not `mount` in case one has to doublecheck: I once had a trouble with a recently cloned hard drive after a reboot, blasting the wrong one with dd(1) after having missed the *real* mounts state (don&#039;t remember the details but LABEL and UUID won&#039;t help to differentiate between bit-per-bit copies, obviously).  There&#039;s a tendency to have /etc/mtab just symlinked to /proc/mounts though.</description> <content:encoded><![CDATA[<p>Just try that (not exactly that command but you&#8217;ll figure it out) in a virtual machine, then think of mmap&#8217;ed files, open handles, cached filesystem metadata.</p><p>On the bright side, on Linux at least one can salvage a (wrongly) deleted file at times by knowing it is still open by a running process, SIGSTOPping that process just in case, examining /proc/THAT_PID/fd/ symlinks and cat(1) the contents of the needed one, conveniently marked as &#8220;(deleted)&#8221;, into a safe place.</p><p>I&#8217;m not a kernel guy either, only fixed iso9660 perms back in 1999 or so for localhost :) but I know freebsd FUD when I see it, and if you failed to find a distro that works for you (like I did in 2001), don&#8217;t blame &#8220;linux&#8221; for it &#8212; it&#8217;s just not professional in the first place.  Ну, не стоит уши под лапшу подставлять и дальше её тиражировать.</p><p>Back to topic: on Linux it might be safer to check /proc/mounts and not `mount` in case one has to doublecheck: I once had a trouble with a recently cloned hard drive after a reboot, blasting the wrong one with dd(1) after having missed the *real* mounts state (don&#8217;t remember the details but LABEL and UUID won&#8217;t help to differentiate between bit-per-bit copies, obviously).  There&#8217;s a tendency to have /etc/mtab just symlinked to /proc/mounts though.</p> ]]></content:encoded> </item> <item><title>By: Valeri Galtsev</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-179060</link> <dc:creator>Valeri Galtsev</dc:creator> <pubDate>Tue, 07 Feb 2012 15:42:41 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-179060</guid> <description>Hm...
with a little knowledge of unix one can realize that
rm -rf /
is _NOT_ as devastating as many think here it is (I would add that as unix certification exam question). Let me re- post here what I already posted:
&quot;...
One thing I couldn’t buy as ultimately devastating though:
rm -rf /
- if I ever manage to do it as root on my *nix box I expect /bin, /boot, and part of /dev gone (and whatever else could be in / alphabetically before /dev on that box). Then the device hosting root filesystem will be deleted, and this will be end of my trouble. The rest: /home, /lib, /lib64, /sbin, /tmp, /usr, /var will stay intact. Other opinions?
Of course, you loose the system on the fly, but you can mount the partitions of the drive on another system, and you will see other filesystems mentioned above intact.</description> <content:encoded><![CDATA[<p>Hm&#8230;<br
/> with a little knowledge of unix one can realize that</p><p>rm -rf /</p><p>is _NOT_ as devastating as many think here it is (I would add that as unix certification exam question). Let me re- post here what I already posted:</p><p>&#8220;&#8230;<br
/> One thing I couldn’t buy as ultimately devastating though:<br
/> rm -rf /<br
/> - if I ever manage to do it as root on my *nix box I expect /bin, /boot, and part of /dev gone (and whatever else could be in / alphabetically before /dev on that box). Then the device hosting root filesystem will be deleted, and this will be end of my trouble. The rest: /home, /lib, /lib64, /sbin, /tmp, /usr, /var will stay intact. Other opinions?</p><p>Of course, you loose the system on the fly, but you can mount the partitions of the drive on another system, and you will see other filesystems mentioned above intact.</p> ]]></content:encoded> </item> <item><title>By: Programie</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-179052</link> <dc:creator>Programie</dc:creator> <pubDate>Tue, 07 Feb 2012 12:25:47 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-179052</guid> <description>You are currently in your systems root directory (/).
You want to delete all files in /tmp but typ &quot;rm -rf /tmp/ *&quot; (Note the space between / and *)
After the command completed successfully, you try to change to another directory. But you can&#039;t. There is nothing!
It doesn&#039;t happen to me yet... but hey, the life can be long. :D
Another mistake which is possible: You are on a remote machine (via SSH) and think you are on your local machine. You want to re-partition your hard disk...</description> <content:encoded><![CDATA[<p>You are currently in your systems root directory (/).<br
/> You want to delete all files in /tmp but typ &#8220;rm -rf /tmp/ *&#8221; (Note the space between / and *)<br
/> After the command completed successfully, you try to change to another directory. But you can&#8217;t. There is nothing!<br
/> It doesn&#8217;t happen to me yet&#8230; but hey, the life can be long. :D</p><p>Another mistake which is possible: You are on a remote machine (via SSH) and think you are on your local machine. You want to re-partition your hard disk&#8230;</p> ]]></content:encoded> </item> <item><title>By: Allen Garvin</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-178822</link> <dc:creator>Allen Garvin</dc:creator> <pubDate>Thu, 19 Jan 2012 17:54:12 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-178822</guid> <description>I once untarred an archive in the root dir. This was long ago, on HP-UX 8. It changed the permissions of the root (/) to 700. Since I was logged on as root, I saw no change in behavior. However, everyone else began seeing very strange behavior, and no one else could log on at all (it would seemingly log them on, then drop them). It took about 20 minutes of looking, before finding the problem.
I did the killall thing once long ago on Solaris, too. It taught me to switch to using pkill everywhere (that had it).
Can&#039;t tell you how many times I installed Solaris in the 90s with a fresh install, and then forgot to enable nis, and had to drive back to the data center afterwards because you couldn&#039;t log in as root in telnet.</description> <content:encoded><![CDATA[<p>I once untarred an archive in the root dir. This was long ago, on HP-UX 8. It changed the permissions of the root (/) to 700. Since I was logged on as root, I saw no change in behavior. However, everyone else began seeing very strange behavior, and no one else could log on at all (it would seemingly log them on, then drop them). It took about 20 minutes of looking, before finding the problem.</p><p>I did the killall thing once long ago on Solaris, too. It taught me to switch to using pkill everywhere (that had it).</p><p>Can&#8217;t tell you how many times I installed Solaris in the 90s with a fresh install, and then forgot to enable nis, and had to drive back to the data center afterwards because you couldn&#8217;t log in as root in telnet.</p> ]]></content:encoded> </item> <item><title>By: Valeri Galtsev</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-178747</link> <dc:creator>Valeri Galtsev</dc:creator> <pubDate>Wed, 18 Jan 2012 07:12:28 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-178747</guid> <description>I don&#039;t mind if moderator deletes my posts: I agree with Michael, my posts are just junk compared to elegant and instructive shell errors found here.
One thing I couldn&#039;t buy as ultimately devastating though:
rm -rf /
- if I ever manage to do it as root on my *nix box I expect /bin, /boot, and part of /dev gone (and whatever else could be in / alphabetically before /dev on that box). Then the device hosting root filesystem will be deleted, and this will be end of my trouble. The rest: /home, /lib, /lib64, /sbin, /tmp, /usr, /var will stay intact. Other opinions?</description> <content:encoded><![CDATA[<p>I don&#8217;t mind if moderator deletes my posts: I agree with Michael, my posts are just junk compared to elegant and instructive shell errors found here.</p><p>One thing I couldn&#8217;t buy as ultimately devastating though:<br
/> rm -rf /<br
/> - if I ever manage to do it as root on my *nix box I expect /bin, /boot, and part of /dev gone (and whatever else could be in / alphabetically before /dev on that box). Then the device hosting root filesystem will be deleted, and this will be end of my trouble. The rest: /home, /lib, /lib64, /sbin, /tmp, /usr, /var will stay intact. Other opinions?</p> ]]></content:encoded> </item> <item><title>By: Valeri Galtsev</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-178745</link> <dc:creator>Valeri Galtsev</dc:creator> <pubDate>Wed, 18 Jan 2012 06:41:00 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-178745</guid> <description>Wow, i didn&#039;t mean to cause an explosion, sorry everybody... And compared to you, Michael, kernel expert, I&#039;m just a humble sysadmin. I only put my dirty hands into kernel once, when we had 32 bit box with 8GB of ram: to get more than 1 GB for user data. I do use Linux a lot, as it&#039;s something that just works for me. Way back I remember 3 year uptime of some of our Linux boxes. A couple of years back I started to seriously look at better alternatives, when Linux became more like windows: every 1.5 Months on average: kernel security update (==reboot)... Respectfully, - Humble Sysadmin.</description> <content:encoded><![CDATA[<p>Wow, i didn&#8217;t mean to cause an explosion, sorry everybody&#8230; And compared to you, Michael, kernel expert, I&#8217;m just a humble sysadmin. I only put my dirty hands into kernel once, when we had 32 bit box with 8GB of ram: to get more than 1 GB for user data. I do use Linux a lot, as it&#8217;s something that just works for me. Way back I remember 3 year uptime of some of our Linux boxes. A couple of years back I started to seriously look at better alternatives, when Linux became more like windows: every 1.5 Months on average: kernel security update (==reboot)&#8230; Respectfully, &#8211; Humble Sysadmin.</p> ]]></content:encoded> </item> <item><title>By: Michael Shigorin</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-178681</link> <dc:creator>Michael Shigorin</dc:creator> <pubDate>Mon, 16 Jan 2012 22:11:12 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-178681</guid> <description>Yup, nothing is perfect under the moon.
Many of my mistakes could be less harmful to me -- and others -- if I learned it earlier that knowing the *weak* sides of what is available and avoiding them is way better than knowing the strong sides and just relying on them...
Thanks Vivek, it was a decent idea for a blog post to share the bumps earned and prompt us colleagues to do the same ;-)</description> <content:encoded><![CDATA[<p>Yup, nothing is perfect under the moon.</p><p>Many of my mistakes could be less harmful to me &#8212; and others &#8212; if I learned it earlier that knowing the *weak* sides of what is available and avoiding them is way better than knowing the strong sides and just relying on them&#8230;</p><p>Thanks Vivek, it was a decent idea for a blog post to share the bumps earned and prompt us colleagues to do the same ;-)</p> ]]></content:encoded> </item> <item><title>By: Cody</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-178680</link> <dc:creator>Cody</dc:creator> <pubDate>Mon, 16 Jan 2012 21:43:56 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-178680</guid> <description>Funny you&#039;d say that Michael. I actually came to this thread for this same reason, but got caught in some other messages I wanted to reply to.
Indeed, there&#039;s such a thing as labels.. uuid&#039;s and so on. Using a different OS for not knowing how to fix a problem when its readily available knowledge seems silly to me. All OS&#039;s have their own flaws and strengths. So does however each human.
But that said - I used to love bsd and scoff at linux. I was even called an elitist by some and frankly I do not blame them. My attitude combined with really extreme sarcasm, I did seem like one! I think one ofthe biggest things I learned (after years of blindness) is to use what works for you! As it happens I much prefer gnu libc than bsd&#039;s much less useful libc (maybe improved by now ?). And this is coming from someone who used tothink, say, C++ is bloated (more specifically OOP&#039;s). My reasoning or even my &quot;defence&quot; was that even Linus says it is. A silly and stupid logic there (more like no logic). I knew that much (it was more of well &#039;if he sees it..&#039;). However, as a friend said to me: you mean the person who created a very bloated OS ? Its true, Linux has a lot of stuff that a lot of people will never use. That doesn&#039;t make it bad or useles.
Point was well taken and I now love OOP (it&#039;s very beneficial, its more type safe  [in C++ versus say C], and really it gave me something new to learn!).
In other words: Linux has flaws.  BSD has flaws. Windows has flaws. MacOS has flaws.. NOTHING is perfect. Use what works for you.</description> <content:encoded><![CDATA[<p>Funny you&#8217;d say that Michael. I actually came to this thread for this same reason, but got caught in some other messages I wanted to reply to.</p><p>Indeed, there&#8217;s such a thing as labels.. uuid&#8217;s and so on. Using a different OS for not knowing how to fix a problem when its readily available knowledge seems silly to me. All OS&#8217;s have their own flaws and strengths. So does however each human.</p><p>But that said &#8211; I used to love bsd and scoff at linux. I was even called an elitist by some and frankly I do not blame them. My attitude combined with really extreme sarcasm, I did seem like one! I think one ofthe biggest things I learned (after years of blindness) is to use what works for you! As it happens I much prefer gnu libc than bsd&#8217;s much less useful libc (maybe improved by now ?). And this is coming from someone who used tothink, say, C++ is bloated (more specifically OOP&#8217;s). My reasoning or even my &#8220;defence&#8221; was that even Linus says it is. A silly and stupid logic there (more like no logic). I knew that much (it was more of well &#8216;if he sees it..&#8217;). However, as a friend said to me: you mean the person who created a very bloated OS ? Its true, Linux has a lot of stuff that a lot of people will never use. That doesn&#8217;t make it bad or useles.</p><p>Point was well taken and I now love OOP (it&#8217;s very beneficial, its more type safe  [in C++ versus say C], and really it gave me something new to learn!).</p><p>In other words: Linux has flaws.  BSD has flaws. Windows has flaws. MacOS has flaws.. NOTHING is perfect. Use what works for you.</p> ]]></content:encoded> </item> <item><title>By: Cody</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-178679</link> <dc:creator>Cody</dc:creator> <pubDate>Mon, 16 Jan 2012 21:31:22 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-178679</guid> <description>As Michael pointed out, the stupid thing is blaming a program for functionality when the person is at fault (please note I&quot;m not trying or not even am calling you stupid, see next point). There&#039;s a reason permissions are the way they are. Something may seem stupid, but does that make it so ?
For instance : You know why you need to be root to chown a file even if it belongs to you ? Does breach of security mean anything to you ? Because as I recall, that would  (could) be the end result. And yes this is very much related to permission issues.</description> <content:encoded><![CDATA[<p>As Michael pointed out, the stupid thing is blaming a program for functionality when the person is at fault (please note I&#8221;m not trying or not even am calling you stupid, see next point). There&#8217;s a reason permissions are the way they are. Something may seem stupid, but does that make it so ?</p><p>For instance : You know why you need to be root to chown a file even if it belongs to you ? Does breach of security mean anything to you ? Because as I recall, that would  (could) be the end result. And yes this is very much related to permission issues.</p> ]]></content:encoded> </item> <item><title>By: Michael Shigorin</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-178677</link> <dc:creator>Michael Shigorin</dc:creator> <pubDate>Mon, 16 Jan 2012 21:22:54 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-178677</guid> <description>Valery, please note (as was noted to me before) that this page is explicitly for recalling troubles and not trying to market one&#039;s crap over someone else&#039;s crap, especially when one blames Linux instead of his own krivye ruki.
With FreeBSD in particular, you could end up with a kernel panic *just* by going over IIRC 7 vinum&#039;s software RAID volumes back in the day, or by plugging a USB storage device into a router not so long ago.
Just in case, I did mess with SATA drives too by plugging &quot;the next one&quot; in a socket with the lower number (that&#039;s pretty easy when one got 6 or 8 of them but quite feasible with even 4 or 2 when there&#039;s no decent light source, you see).  *BUT* I didn&#039;t reverse the dd if/of so far due to a habit of &quot;fdisk -l&quot; and other double-checking before things like that.
Please stop spreading that lame misinformation on device numbering as the bus scan order can change with BIOS, kernel, or kernel option *BUT* you&#039;re wrong again, uchite matchast&#039; (e.g. udev&#039;s KERNEL variable description for a start).
One of the fundamental mistakes a *NIX admin can do is listen carelessly for some local &quot;authority&quot; who would &quot;back&quot; their words by being loud and proud, and not by being actually knowledgeable and reasonable (the test is &quot;why?&quot;).  That&#039;s pretty wide-spread in Russian-speaking *BSD circles, unfortunately.</description> <content:encoded><![CDATA[<p>Valery, please note (as was noted to me before) that this page is explicitly for recalling troubles and not trying to market one&#8217;s crap over someone else&#8217;s crap, especially when one blames Linux instead of his own krivye ruki.</p><p>With FreeBSD in particular, you could end up with a kernel panic *just* by going over IIRC 7 vinum&#8217;s software RAID volumes back in the day, or by plugging a USB storage device into a router not so long ago.</p><p>Just in case, I did mess with SATA drives too by plugging &#8220;the next one&#8221; in a socket with the lower number (that&#8217;s pretty easy when one got 6 or 8 of them but quite feasible with even 4 or 2 when there&#8217;s no decent light source, you see).  *BUT* I didn&#8217;t reverse the dd if/of so far due to a habit of &#8220;fdisk -l&#8221; and other double-checking before things like that.</p><p>Please stop spreading that lame misinformation on device numbering as the bus scan order can change with BIOS, kernel, or kernel option *BUT* you&#8217;re wrong again, uchite matchast&#8217; (e.g. udev&#8217;s KERNEL variable description for a start).</p><p>One of the fundamental mistakes a *NIX admin can do is listen carelessly for some local &#8220;authority&#8221; who would &#8220;back&#8221; their words by being loud and proud, and not by being actually knowledgeable and reasonable (the test is &#8220;why?&#8221;).  That&#8217;s pretty wide-spread in Russian-speaking *BSD circles, unfortunately.</p> ]]></content:encoded> </item> <item><title>By: Cody</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-178676</link> <dc:creator>Cody</dc:creator> <pubDate>Mon, 16 Jan 2012 21:15:05 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-178676</guid> <description>Sounds like my mom&#039;s office (telecommunication). They&#039;re relentless. That&#039;s a pretty funny story (and thing to call you; sure it&#039;s at your expense but it&#039;s not really that mean, and its more clever).
I think my favourite story is something that your (Jose&#039;s) story reminds me of. My mom fixes databases and other problems. One time there was a database issue she was debugging. She was talking to the person on the phone. The person kept reading the error he was getting to my mom (over phone). Finally, my mom realized that he had actually printed out the file right - the file is what contained an error - not the printer itself! In other words, he printed out a file that contained the error and he thought that it was the printer having an issue. But hey, he learned from it and we all make mistakes at times. Those who say you should just fire them don&#039;t realize that if that were the case they&#039;d have no employees (and potentially law suits - yes, I&#039;m serious. Some firings over things that may seem harmless can lead to lawsuits, whether its not a legit/unfounded case or not).</description> <content:encoded><![CDATA[<p>Sounds like my mom&#8217;s office (telecommunication). They&#8217;re relentless. That&#8217;s a pretty funny story (and thing to call you; sure it&#8217;s at your expense but it&#8217;s not really that mean, and its more clever).</p><p>I think my favourite story is something that your (Jose&#8217;s) story reminds me of. My mom fixes databases and other problems. One time there was a database issue she was debugging. She was talking to the person on the phone. The person kept reading the error he was getting to my mom (over phone). Finally, my mom realized that he had actually printed out the file right &#8211; the file is what contained an error &#8211; not the printer itself! In other words, he printed out a file that contained the error and he thought that it was the printer having an issue. But hey, he learned from it and we all make mistakes at times. Those who say you should just fire them don&#8217;t realize that if that were the case they&#8217;d have no employees (and potentially law suits &#8211; yes, I&#8217;m serious. Some firings over things that may seem harmless can lead to lawsuits, whether its not a legit/unfounded case or not).</p> ]]></content:encoded> </item> <item><title>By: Valeri Galtsev</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-178675</link> <dc:creator>Valeri Galtsev</dc:creator> <pubDate>Mon, 16 Jan 2012 20:56:13 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-178675</guid> <description>Yes, linux has quite a few weird (well, illogical) things. You had one drive, it was assigned sda device name. You added second drive to clone firs onto, but when you booted _linux_ live CD, former sda device was assigned sdb name and second drive: sda. Expect dd cloning to fail unless you know linux id weird here or better test which device is which. The same is (at least was for quite some time) about network interfaces. Linux names devices in an order of discovery of devices, only it reverses it as if it pushes devices into stack, and assigned names later when pulling them from stack. BSD in this respect is much better: it assigned device names according to their physical place in hardware.</description> <content:encoded><![CDATA[<p>Yes, linux has quite a few weird (well, illogical) things. You had one drive, it was assigned sda device name. You added second drive to clone firs onto, but when you booted _linux_ live CD, former sda device was assigned sdb name and second drive: sda. Expect dd cloning to fail unless you know linux id weird here or better test which device is which. The same is (at least was for quite some time) about network interfaces. Linux names devices in an order of discovery of devices, only it reverses it as if it pushes devices into stack, and assigned names later when pulling them from stack. BSD in this respect is much better: it assigned device names according to their physical place in hardware.</p> ]]></content:encoded> </item> <item><title>By: Valeri Galtsev</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-178674</link> <dc:creator>Valeri Galtsev</dc:creator> <pubDate>Mon, 16 Jan 2012 20:40:58 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-178674</guid> <description>Hm... somehow rsync works differently for me (on FreeBSD, Linux - CentOS 6, Mac OS 10.6). In particular, rsyncing empty directory onto not empty directory doesn&#039;t change anything. I.e., rsync works as documented: it copies over to destination _only_ files that have older timestamp on destination, leaving everything intact. If one wants to also keep an older copy of file being updated, one can add -b option (which will rename older &quot;file&quot; into &quot;file~&quot; before copying newer version.
[valeri@point ~]$ mkdir test1
[valeri@point ~]$ mkdir -p test2/test1
[valeri@point ~]$ touch test2/test1/file
[valeri@point ~]$ rsync -avu test1 test2
sending incremental file list
test1/
sent 57 bytes  received 16 bytes  146.00 bytes/sec
total size is 0  speedup is 0.00
[valeri@point ~]$ ls test2/test1/file
test2/test1/file
- you see, the &quot;file&quot; still exists! I use rsync for years, I never had anything trashed by it. But I _did_ my share of other flops described here!</description> <content:encoded><![CDATA[<p>Hm&#8230; somehow rsync works differently for me (on FreeBSD, Linux &#8211; CentOS 6, Mac OS 10.6). In particular, rsyncing empty directory onto not empty directory doesn&#8217;t change anything. I.e., rsync works as documented: it copies over to destination _only_ files that have older timestamp on destination, leaving everything intact. If one wants to also keep an older copy of file being updated, one can add -b option (which will rename older &#8220;file&#8221; into &#8220;file~&#8221; before copying newer version.</p><p>[valeri@point ~]$ mkdir test1<br
/> [valeri@point ~]$ mkdir -p test2/test1<br
/> [valeri@point ~]$ touch test2/test1/file<br
/> [valeri@point ~]$ rsync -avu test1 test2<br
/> sending incremental file list<br
/> test1/</p><p>sent 57 bytes  received 16 bytes  146.00 bytes/sec<br
/> total size is 0  speedup is 0.00<br
/> [valeri@point ~]$ ls test2/test1/file<br
/> test2/test1/file</p><p>- you see, the &#8220;file&#8221; still exists! I use rsync for years, I never had anything trashed by it. But I _did_ my share of other flops described here!</p> ]]></content:encoded> </item> <item><title>By: Oisín</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-178664</link> <dc:creator>Oisín</dc:creator> <pubDate>Mon, 16 Jan 2012 17:35:20 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-178664</guid> <description>&quot;Mount a partition and have a nosey prior to hosing it (sometimes it won’t work coz it’s never had anything in it, but still: if the mount unexectedly works …)&quot;
Good point, which saved my skin a few times... &quot;I&#039;ll format that for the new backup partition. Well, I&#039;ll just check if there&#039;s anything on it and... wait, isn&#039;t that my Windows partition? That&#039;s not possible, because /dev/sdb is supposed to ... oh, I plugged in that thing and... &lt;em&gt;yikes&lt;/em&gt;.&quot;</description> <content:encoded><![CDATA[<p>&#8220;Mount a partition and have a nosey prior to hosing it (sometimes it won’t work coz it’s never had anything in it, but still: if the mount unexectedly works …)&#8221;</p><p>Good point, which saved my skin a few times&#8230; &#8220;I&#8217;ll format that for the new backup partition. Well, I&#8217;ll just check if there&#8217;s anything on it and&#8230; wait, isn&#8217;t that my Windows partition? That&#8217;s not possible, because /dev/sdb is supposed to &#8230; oh, I plugged in that thing and&#8230; <em>yikes</em>.&#8221;</p> ]]></content:encoded> </item> <item><title>By: Beus</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-178663</link> <dc:creator>Beus</dc:creator> <pubDate>Mon, 16 Jan 2012 16:32:18 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-178663</guid> <description>- Adding echo before the actual effective command when making any automated file-manipulation script and only removing it after several satisfactory test-runs is exactly my approach, too :)
- If creating a brand-new-file from redirection, I use the advantage of tabkey completion ;)
- When editing config files, I usually just copy &amp; comment out the original line(s) and then edit - it saves time spent by diff-ing the versions. This way I sometimes get configs a few times larger than they have to be, but an occasional cleanup of unnecessary stuff during the next edit takes care of that :-)
- As to the root access - I never have any root-shell window at all and do everything under my user. If anything really needs root privileges, on machines not needing top security I avoid having to type the root/sudo password each time by just running &quot;do command parameters&quot; where &quot;do&quot; is a tiny hyper-simple program in my ~/bin (which I have in $PATH) running the rest of its commandline under root privileges (has chown root:special_group and chmod 4510 (r-s--x---) ), basically going like this:
&lt;pre&gt;setuid(geteuid());
execvp(argv[1],argv+1);
&lt;/pre&gt;
Mine is extended by running the shell if run without parameters but I almost never leave such a shell open unused.
I even used this on some servers - being executable by only a certain group together with hiding it in odd locations provided high enough level of security (even if someone gained an access to one of the root-allowed users&#039; accounts, would have to know what to run).
- Anyway, what contributes most to the commandline safety is the distinction in prompt - I always set it up to show hostname[tty]:dir&gt; for me and root@hostname[tty]:dir&gt; for root, sometimes in different colour. This way I&#039;m always warned that it&#039;s a root-shell before issuing a command. Benefit of always seeing the hostname and directory prior to even starting to type a command or manipulating files does not need any explanation (or if hostname is not distinguishing enough, just use any string to identify the machine) and knowing the tty proved very useful when hunting processes.
So, the prompt consumes the whole line sometimes (in some deep subdir trees) but the information it provides is worth that space, and it&#039;s more convenient and safe than to check for &quot;pwd&quot; or &quot;hostname&quot; each time, what you can forget sometimes (especially when tired, what is the worst time to run dangerous commands) :)</description> <content:encoded><![CDATA[<p>- Adding echo before the actual effective command when making any automated file-manipulation script and only removing it after several satisfactory test-runs is exactly my approach, too :)<br
/> - If creating a brand-new-file from redirection, I use the advantage of tabkey completion ;)<br
/> - When editing config files, I usually just copy &amp; comment out the original line(s) and then edit &#8211; it saves time spent by diff-ing the versions. This way I sometimes get configs a few times larger than they have to be, but an occasional cleanup of unnecessary stuff during the next edit takes care of that :-)<br
/> - As to the root access &#8211; I never have any root-shell window at all and do everything under my user. If anything really needs root privileges, on machines not needing top security I avoid having to type the root/sudo password each time by just running &#8220;do command parameters&#8221; where &#8220;do&#8221; is a tiny hyper-simple program in my ~/bin (which I have in $PATH) running the rest of its commandline under root privileges (has chown root:special_group and chmod 4510 (r-s&#8211;x&#8212;) ), basically going like this:</p><pre>setuid(geteuid());
execvp(argv[1],argv+1);
</pre><p>Mine is extended by running the shell if run without parameters but I almost never leave such a shell open unused.<br
/> I even used this on some servers &#8211; being executable by only a certain group together with hiding it in odd locations provided high enough level of security (even if someone gained an access to one of the root-allowed users&#8217; accounts, would have to know what to run).<br
/> - Anyway, what contributes most to the commandline safety is the distinction in prompt &#8211; I always set it up to show hostname[tty]:dir&gt; for me and root@hostname[tty]:dir&gt; for root, sometimes in different colour. This way I&#8217;m always warned that it&#8217;s a root-shell before issuing a command. Benefit of always seeing the hostname and directory prior to even starting to type a command or manipulating files does not need any explanation (or if hostname is not distinguishing enough, just use any string to identify the machine) and knowing the tty proved very useful when hunting processes.<br
/> So, the prompt consumes the whole line sometimes (in some deep subdir trees) but the information it provides is worth that space, and it&#8217;s more convenient and safe than to check for &#8220;pwd&#8221; or &#8220;hostname&#8221; each time, what you can forget sometimes (especially when tired, what is the worst time to run dangerous commands) :)</p> ]]></content:encoded> </item> <item><title>By: Kiwi Nick</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-178637</link> <dc:creator>Kiwi Nick</dc:creator> <pubDate>Mon, 16 Jan 2012 08:28:11 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-178637</guid> <description>A few more, for major reconfigurations.
&lt;ul&gt;
&lt;li&gt;During major reconfigurations (using a liveCD), I mount everything -r (readonly) unless the task demands I write into that partition.
&lt;li&gt;Mount a partition and have a nosey prior to hosing it (sometimes it won&#039;t work coz it&#039;s never had anything in it, but still: if the mount unexectedly works ...)
&lt;li&gt;Prior to removing a large directory tree, chmod 000; and/or, mv -i; to a new name, and leave it for a few days, to see if anything stops working.
&lt;li&gt;rpm --test as a non-root user, prior to the real rpm.
&lt;/ul&gt;
Ironic: there&#039;s an advert below this box saying OMG&#039;S of the week (Telstra). Yes, it&#039;s a bit like that.</description> <content:encoded><![CDATA[<p>A few more, for major reconfigurations.</p><ul><li>During major reconfigurations (using a liveCD), I mount everything -r (readonly) unless the task demands I write into that partition.</li><li>Mount a partition and have a nosey prior to hosing it (sometimes it won&#8217;t work coz it&#8217;s never had anything in it, but still: if the mount unexectedly works &#8230;)</li><li>Prior to removing a large directory tree, chmod 000; and/or, mv -i; to a new name, and leave it for a few days, to see if anything stops working.</li><li>rpm &#8211;test as a non-root user, prior to the real rpm.</li></ul><p>Ironic: there&#8217;s an advert below this box saying OMG&#8217;S of the week (Telstra). Yes, it&#8217;s a bit like that.</p> ]]></content:encoded> </item> <item><title>By: Kiwi Nick</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-178636</link> <dc:creator>Kiwi Nick</dc:creator> <pubDate>Mon, 16 Jan 2012 08:09:44 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-178636</guid> <description>Now for some prevention.
&lt;ul&gt;
&lt;li&gt;mv -i ## always use -i
&lt;li&gt;rm -i ## at least when you have your L-plates on (L-plates is Aus slang for &quot;learner driver&quot;).
&lt;li&gt;Only execute something as root if it won&#039;t work otherwise; I generally have two windows open: my normal user and the root user, and I do things like &#039;ls, cat, less&#039; in the normal window. Then I do things like vi, or rm as root (but I do a ls just before the rm, as root).
&lt;li&gt;I configure my root windows with a different background colour.
&lt;li&gt;pwd; prior to rm or recursive commands.
&lt;li&gt;prior to a recursive command on a small directory tree, find . -print; or, find . -type d -print; see how many files will be affected (or for slightly larger situations, the second one gives the range of directories to be affected).
&lt;li&gt;When I write a script to rename files or change them in a robotic manner, I put an echo in front of the intended command, so it will give me the commands that are going to happen. If satisfied, I remove the echo, to let the command actually happen.
&lt;li&gt;If I&#039;m editing files in a robotic manner (by script), I create the new files with a backup extension (eg file.cxx becomes file.cxx.new). Then I diff the various original files against their new ones, to ensure it is as intended, then I rename the files, mv -i ; and keep my eyes peeled as I say yes to each one.
&lt;li&gt;The &gt; is your enemy. If I want to create a brand new file by redirection, I ... cat brand_new_file; (expect a not found error), then some-cmd &gt; brand_new_file;
&lt;li&gt;If I want to append by redirection, I make a backup of the target file regardless.
&lt;li&gt;When I edit a config file in /etc (or anywhere), I ... cp -i file.conf file.conf.20120116; named after today&#039;s date. The dates aren&#039;t that truthful, but it&#039;s miles better than anything.
&lt;li&gt;Create dedicated users for running VMs and similar (especially if they are shared). That&#039;s the approach Apache uses (usually automated).
&lt;/ul&gt;</description> <content:encoded><![CDATA[<p>Now for some prevention.</p><ul><li>mv -i ## always use -i</li><li>rm -i ## at least when you have your L-plates on (L-plates is Aus slang for &#8220;learner driver&#8221;).</li><li>Only execute something as root if it won&#8217;t work otherwise; I generally have two windows open: my normal user and the root user, and I do things like &#8216;ls, cat, less&#8217; in the normal window. Then I do things like vi, or rm as root (but I do a ls just before the rm, as root).</li><li>I configure my root windows with a different background colour.</li><li>pwd; prior to rm or recursive commands.</li><li>prior to a recursive command on a small directory tree, find . -print; or, find . -type d -print; see how many files will be affected (or for slightly larger situations, the second one gives the range of directories to be affected).</li><li>When I write a script to rename files or change them in a robotic manner, I put an echo in front of the intended command, so it will give me the commands that are going to happen. If satisfied, I remove the echo, to let the command actually happen.</li><li>If I&#8217;m editing files in a robotic manner (by script), I create the new files with a backup extension (eg file.cxx becomes file.cxx.new). Then I diff the various original files against their new ones, to ensure it is as intended, then I rename the files, mv -i ; and keep my eyes peeled as I say yes to each one.</li><li>The &gt; is your enemy. If I want to create a brand new file by redirection, I &#8230; cat brand_new_file; (expect a not found error), then some-cmd &gt; brand_new_file;</li><li>If I want to append by redirection, I make a backup of the target file regardless.</li><li>When I edit a config file in /etc (or anywhere), I &#8230; cp -i file.conf file.conf.20120116; named after today&#8217;s date. The dates aren&#8217;t that truthful, but it&#8217;s miles better than anything.</li><li>Create dedicated users for running VMs and similar (especially if they are shared). That&#8217;s the approach Apache uses (usually automated).</li></ul> ]]></content:encoded> </item> <item><title>By: Kiwi Nick</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-178634</link> <dc:creator>Kiwi Nick</dc:creator> <pubDate>Mon, 16 Jan 2012 07:41:16 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-178634</guid> <description>A few that I&#039;ve seen happen
&lt;ol&gt;
&lt;li&gt;SQL: DELETE FROM some_table;   -- missing WHERE clause. Bun fight for the next 3 hours for the trained monkeys at the client to get the backup tapes for a restore.
&lt;li&gt;There is a Linux installation where almost EVERYONE has the same home directory (no need to store user-specific stuff on this machine, they all share the same .profile). From force of habit: userdel -r minion; ## because minion had left the company. -r wiped out the shared home dir for all users, including all the DBF files for the production Oracle database. About a day&#039;s downtime.
&lt;li&gt;The same guy made a second mistake: logged in remotely to a Unix server, he goes: ifdown eth0; ## then intended to ifup eth0; to pick up a config change. But he couldn&#039;t get his prompt back after the first command, I wonder why ;-)  He rang up and told someone to force the power off, then on.
&lt;li&gt;An entire group of suburbs without phone service for a day: some vague rumour about something misconfigured.
&lt;li&gt;One that I did myself: very early days of Unix - confusing rm instead of mv. It was only a single file deleted (the intended destination didn&#039;t exist, and rm croaked with the error, which alerted me to the mistake). But it was still 2 hours recreating the C-program assignment from memory - some one else&#039;s who I was helping.
&lt;li&gt;Another one I did myself: swapping between the CVS storage area, and the equivalent working directory in my home directory: wanted to delete part of the working directory tree and start over: rm -fr stem_of_tree; ## but in the CVS area, not mine. Got someone to restore from backups. It was a pretty rudimentary CVS setup.</description> <content:encoded><![CDATA[<p>A few that I&#8217;ve seen happen</p><ol><li>SQL: DELETE FROM some_table;   &#8212; missing WHERE clause. Bun fight for the next 3 hours for the trained monkeys at the client to get the backup tapes for a restore.</li><li>There is a Linux installation where almost EVERYONE has the same home directory (no need to store user-specific stuff on this machine, they all share the same .profile). From force of habit: userdel -r minion; ## because minion had left the company. -r wiped out the shared home dir for all users, including all the DBF files for the production Oracle database. About a day&#8217;s downtime.</li><li>The same guy made a second mistake: logged in remotely to a Unix server, he goes: ifdown eth0; ## then intended to ifup eth0; to pick up a config change. But he couldn&#8217;t get his prompt back after the first command, I wonder why ;-)  He rang up and told someone to force the power off, then on.</li><li>An entire group of suburbs without phone service for a day: some vague rumour about something misconfigured.</li><li>One that I did myself: very early days of Unix &#8211; confusing rm instead of mv. It was only a single file deleted (the intended destination didn&#8217;t exist, and rm croaked with the error, which alerted me to the mistake). But it was still 2 hours recreating the C-program assignment from memory &#8211; some one else&#8217;s who I was helping.</li><li>Another one I did myself: swapping between the CVS storage area, and the equivalent working directory in my home directory: wanted to delete part of the working directory tree and start over: rm -fr stem_of_tree; ## but in the CVS area, not mine. Got someone to restore from backups. It was a pretty rudimentary CVS setup.</li></ol> ]]></content:encoded> </item> <item><title>By: Been there done that</title><link>http://www.cyberciti.biz/tips/my-10-unix-command-line-mistakes.html#comment-178279</link> <dc:creator>Been there done that</dc:creator> <pubDate>Mon, 09 Jan 2012 17:29:13 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/?p=5159#comment-178279</guid> <description>Working for a hosting company has given me some interesting experiences.
Like the time a customer support agent gave a customer the instruction (via email) to simply execute on his CentOS box [rpm -e XXX]. Apparently the customer didn&#039;t understand so the customer support agent typed in [rpm -e ] and then pasted [rpm -e XXX]. I spent well over 6 hours getting RPM functional again and I can assure you it is &lt;strong&gt;not&lt;/strong&gt; a fun experience.
Or the entertaining situation created when a customer support agent wanted to &quot;grow&quot; an existing partition for a customer on a second drive by creating a new partition with the same name and then mounted it over the existing partition. Nothing was lost, but you should have heard the customer scream about his &quot;data loss&quot;. Luckily, mounting a partition in this fashion doesn&#039;t erase data but simply hides it - yet it still took several of us a couple of hours to figure out what had actually transpired...</description> <content:encoded><![CDATA[<p>Working for a hosting company has given me some interesting experiences.</p><p>Like the time a customer support agent gave a customer the instruction (via email) to simply execute on his CentOS box [rpm -e XXX]. Apparently the customer didn&#8217;t understand so the customer support agent typed in [rpm -e ] and then pasted [rpm -e XXX]. I spent well over 6 hours getting RPM functional again and I can assure you it is <strong>not</strong> a fun experience.</p><p>Or the entertaining situation created when a customer support agent wanted to &#8220;grow&#8221; an existing partition for a customer on a second drive by creating a new partition with the same name and then mounted it over the existing partition. Nothing was lost, but you should have heard the customer scream about his &#8220;data loss&#8221;. Luckily, mounting a partition in this fashion doesn&#8217;t erase data but simply hides it &#8211; yet it still took several of us a couple of hours to figure out what had actually transpired&#8230;</p> ]]></content:encoded> </item> </channel> </rss>
