IamCraig.com Rotating Header Image


Posts related to the Linux operating system.

man page humour

Found this little nugget in the “find” man page recently:

A ‘%’ character followed by any other character is discarded, but the other character is printed (don’t rely on this, as further format characters may be introduced). A ‘%’ at the end of the format argument causes undefined behaviour since there is no following character. In some locales, it may hide your door keys, while in others it may remove the final page from the novel you are reading.

Reminds me of a T-shirt I have:

$> man woman
$> Segmentation fault (core dumped)

Deleting files under Linux/Unix

Today I came across a comment on a blog post related to deleting files on a Unix/Linux system that was a clear case of bullshit. I tried to post a comment to that effect on the blog in question, but the comment feature was broken. So, since I had already gone to the trouble of writing my response, and since I don’t post nearly as much to my own blog as I would like, I’ll just post it here instead.

To PoorMe, who claimed to have “just lost all of [his/her] files and folders on [his/her] server in just 2 seconds” by running the suggested command, I call bullshit!

I actually intentionally tried this a few years ago on a server that I was decommissioning. First of all, you have to be in the root directory for the dreaded “rm -rf *” command to try and remove everything (unless you craft the command explicitly to remove everything under the root directory), and you’re almost never in the root directory unless you place yourself there for some specific and very unusual reason.

Secondly, in my test (which I did run as root) I ran into many files and directories that threw up errors and interrupted the process, even though I used the “-f” flag. In fact, I ended up having to delete individual directories off of the root to do what I was trying to achieve, and even then I gave up trying to remove anything but directories I knew contained user data.

Thirdly, even without those errors the process would have taken minutes, if not hours, not “2 seconds”. Anyone who thinks it takes two seconds has obviously never tried it. Besides, assuming you’re connecting over SSH, how are you still connected if you deleted everything, including the SSH server?

Bottom line, don’t run commands on your system that you find on the Internet without first understanding and checking them. But even if you don’t take that advice, the chances of you erasing every file and directory on your server in the blink of an eye are close to zero. Sure, you might erase a whole lot of stuff you didn’t want to erase that you may never get back and which may destabilise your system requiring you to reinstall the operating system (and it may happen in as few as two seconds), but what PoorMe claims happened almost certainly didn’t happen.

Goodbye Windows! Goodbye Google!

The day is finally here! It’s 8 April 2014, and support for Windows XP has ended. Years ago — I really don’t remember how many — I swore that XP would be the last version of Windows that I’d run. Not because XP was any worse than versions of Windows before it; on the contrary, having finally reached a level of acceptable stability with Windows 2000, XP continued that and I was generally happy, although that happiness (contentedness, rather) has been badly tinged in the last couple of years by the fact that my older machine (still easily meeting the technical requirements for XP) got more and more bogged down by the crap that everyone feels they need to load into their web pages.

But back in the mists of time I saw where Microsoft was going with Windows, and I wanted no part of it. Whether they succeeded or not with their plans for DRM, I wanted no part of their philosophy. (Apple is even worse, not to mention ridiculously overpriced, so that certainly was never going to be an option.) Besides those issues, I recently helped a friend buy a new computer and I was just aghast at Windows 8. It’s horrible! Maybe as someone who got his start on an Apple ][ and then moved to DOS, I’m just an irrelevant old fuddy-duddy now, but I’m still a reasonably productive (no old-age home yet) and paying consumer, and Windows 8 would not do anything to help with my productivity.

So with the countdown clock winding rapidly down to today, I bought a new machine from System76 that came with Ubuntu Linux. I’m still getting my sea legs on it, but I’m very happy so far. If you’ve ever used swear words when dealing with Windows and you’d like to consider alternatives but you’re worried for some reason about trying Linux, don’t be. So far I’ve found that it feels like all that has happened to my daily experience is that what Windows calls the “task bar” has moved from the bottom of my screen to the left edge (I could probably move it, but I’m not that motivated to do so), the close button has moved to the top, left-hand corner from the right (but Alt-F4 still does the same thing), and I now have a thin combination between a task bar and a menu bar at the top of my screen. In other words, my mind is not preoccupied with figuring out how everything works, and I’m more productive because I have new hardware. It’s a win all around. As someone who has watched former Windows users (including myself) tear their hair out trying to figure out the so-called intuitive Mac operating system, I’m very happy so far.

Even selecting new applications has been a breeze so far, with one exception. Not counting background programs (generally those running in the Windows system tray), on Windows I generally manually run four programs as soon as I log on: an email client, a text editor, a web browser and a terminal window. On Windows these were Eudora, TextPad, Firefox and (of course) a DOS box.

I’ve been a Eudora user since version 2 (in April 1996 when I bought my first GUI-based computer running Windows 95), almost twenty years ago! Over time I tried Thunderbird, Outlook and Outlook Express (and considered others, not the least of which was Pegasus), but they all failed to impress me. Even when Qualcomm stopped developing Eudora in 2006 (version 7 for Windows, 6 for the Mac) I kept using it. (Don’t forget, the standards on which email is based go back to the 1960s!) Qualcomm passed along something — I’m not entirely sure what, other than the name, but not much and certainly no substantial code if any at all — to the Mozilla Foundation and they were supposed to develop a Thunderbird-based “new Eudora”, keeping as many of the features of Eudora as possible that made it such a superior email client. To make a lengthening story shorter (I should have seen the writing on the wall, given my lack of enthusiasm for Thunderbird), Eudora was pissed down the toilet and (known by then by the project name “Penelope” and then as Eudora OSE) died a cruel death. Ironically, the lack of Eudora on Linux (unless you run it in an emulator) was my biggest worry about switching to Linux, but circumstances have conspired to force my hand anyway.

TextPad is a great editor, although a Windows-only program, but Linux is famous for its text editors. (I mainly used TextPad as a note-taking and text-processing application anyway; for coding I used Notepad++ [Notepad Plus Plus, aka Notepad Double Plus].) Firefox runs on Linux; and of course Linux has a far better, more functional and more versatile command line. The fact that I have (with the significant exceptions of Eudora and TextPad that I’ve used for so long) been drawn to open-source software (even on Windows) means that I can keep using on Linux some of the programs I’ve been using on Windows: GIMP, KeePass, the aforementioned Firefox, and more. This is good.

So what am I using now for email on Linux? After some research I have (for now; I’m still evaluating) settled on Evolution as my new email client, but I may also evaluate Zimbra‘s email client. I’m also still using Gedit (the default editor in Ubuntu) with some plug-ins to replicate what I had with TextPad, but I haven’t made a final decision on that yet either.

Hopefully I’ll have more to say about GUI Linux and System76 in the near future.

And what does Google have to do with all of this? Well, the other thing that I am changing after so many years is the Web search engine I use. The last time I did that was when I switched from AltaVista to Google in the late nineties or early noughties! But today is about dumping particularly evil companies, so it seems a good time to double the celebration. Unfortunately, due to the reach of their evil I can’t dump Google entirely, but I’m making a first step by not feeding them with free data about my life through their search engine. I don’t trust anyone online any more, but for now DuckDuckGo seems as good a search engine to use. In fact, if they didn’t have such a stupid name I’d probably have realised what they were and switched much sooner!

Installing Zend Optimiser

I had a bit of an education on the confusing array of Zend products recently. A client needed Zend Optimizer (which, of course, Zend spells with a “z” to cater to the all-powerful American market) installed on their virtual private server (running Linux, of course), as the installation routine for a web application wouldn’t proceed without it. Fair enough. Some web applications are encoded so that they can’t be hacked (as opposed to cracked; see the difference), reverse engineered, modified, etc., and Zend Optimiser interprets the encoded PHP files so that they can run.

But I was confused. I thought Zend was installed with PHP by default. Turns out it’s Zend Engine that’s installed with PHP. So off I go to the interwebs to do some research. Take a look at these pages:

  • Zend Products: Here are listed Zend Server, Zend Server Cluster Manager, Zend Studio and Zend Guard — four products.
  • Zend Downloads: Here are listed Zend Server, Zend Server Cluster Manager, Zend Server Community Edition, Zend Studio, Zend Guard, Zend Optimizer, Zend Framework, Zend Core and Zend Platform. Phew! Nine products!

You don’t even see Zend Engine listed on either of the above pages, presumably because it’s installed with PHP by default.

So you click on Zend Optimiser and you’re presented with downloads for Zend Guard, Zend Optimiser and Zend Guard Loader. Huh? What’s what, where did Zend Guard Loader come from, and what is it?

Add to that that, in the back of my mind, I thought I had been down this road before on a different server that I’m sure already had a decoder installed. However, I figured out that I was probably thinking of Ioncube, and it had likely been installed with a control panel on that server.

Add further to that confusion the plethora of different instructions you find in a web search, some of which (including the “user guide” that is linked to right next to the Zend Optimizer download link) refer to an installation script which doesn’t exist in the download, and you can see why I was left scratching my head. At one point I even started following the RPM installation instructions on the Zend website, until I said to myself, “Wait a minute. This isn’t right.” Sure enough, those instructions were for a different Zend product.

The download does include what are referred to on some websites as “manual” installation instructions. They’re straightforward, but the confusing array of different options out there threw me off. In the end, the “manual” instructions did indeed work — and given the choice I’d prefer them anyway — and took all of about three minutes, far less time than I had already wasted.