Thursday, March 29, 2012

Is Ubuntu becoming synonymous with Linux?

Lately I have come across some (less geeky) folks who have heard of "Ubuntu" but were not familiar with "Linux". This got me thinking. Is Ubuntu becoming synonymous with Linux (in a way)?

Think about it. Since coming on the scene 8 years ago, Ubuntu has quickly become the most popular Desktop Linux Distribution...ever. Period. Regardless of your standing on Ubuntu, love it or hate it, or what distro you run, you can't deny that. Sure, although Red Hat (along w/ CentOS and other RHEL clones) have the server market tied up (for now), I really don't think I could get by running anything other than Ubuntu (or a derivative such as Linux Mint) as a destkop distro these days. The entire purpose of a "distribution" is to package Linux and other applications in an easy-to-install and configure package. This is why I scratch my head at so-called "advanced" distros like Arch and Gentoo (I've tried Arch, but not Gentoo - not passing judgement on these two distros at all - just making a generalization).

I make the statement "Ubuntu is the most popular desktop distribution" as though it is fact, but how can I back it up? Distrowatch rankings? Nah...I've never liked that metric. Web traffic statistics? Nah, that doesn't always (if ever) identify the distro. Take Shuttleworth's word of "over 20 million Ubuntu Users"?...maybe, but that doesn't tell me how many users Fedora has. Although not scientific, I decided to play around with Google Trends some, and this is what I came up with. Take these graphs with a grain of salt, but I found it interesting to see how Ubuntu fared against other distros in regards to Google Search traffic since 2004.

First, Ubuntu vs. Debian (remember, Ubuntu is based on Debian):



Notice that Debian stays almost flat until Ubuntu and Debian intersect late in 2005, and Ubuntu steadily gains ground thereafter.

Next up, Ubuntu vs Slackware (the oldest surviving Linux distribution):


Poor Slackware has all but fallen off of the map...which is a shame, as it's what I ran before Ubuntu.

Now, let's try Ubuntu vs. Fedora:




The Ubuntu-Fedora graph reminds me the Debian one - once Ubuntu intersects with Fedora in 2005, it continues to gain ground while Fedora slowly gets less, and less search traffic.

How about the one-time power-user favorite Gentoo:


Like Slackware, Gentoo seems to be fading away, at least if you go by the amount of search volume.

Ok...let's try another more mainstream distro; Ubuntu vs. openSUSE:


I was torn over if I should use "Suse" or "openSUSE". The "Suse" graph pretty much ended a little after 2005, but the openSUSE graph didn't fair much better.

Ok, so I compared a few distros, so then I decided to have some fun...

How about Ubuntu vs Windows:


Um...yeah. :-)

This one surprised me a little; Ubuntu vs OS X:


I tried a few variations with this one, such as "MacOS", "OSX", "Mac OS X" and they all looked about the same.

So...what did that get us? Not much a few pretty graphs. This next graph is the point of this post though. Is "Ubuntu" becoming synonymous with "Linux"? Well check this out:


As with the other graphs, I take this with a grain of salt, but it's interesting to see the "Linux" traffic slowly decreasing as the "Ubuntu" traffic creeps up to finally practically meet late in 2009, and continue on in parallel.

Does this in fact mean that Ubuntu is synonymous with Linux? Nah, I don't think that for one second. I do think it means that there are a lot of Ubuntu users out there, and they are searching for "Ubuntu" rather than "Linux". Makes for an interesting graph and something to talk about though, and it *does* make you think...doesn't it?

As an interesting side note, I found it very interesting how you can see the "peaks" at release time...especially in the cases of Ubuntu and Fedora.

Thursday, March 22, 2012

Parsing E-mail with PHP

I recently had a need to parse e-mail being piped in from Postfix and insert the exploded headers and message into a database running MS SQL.

It sounds simple enough, and once I started doing some searching, it seems that a ton of people have all sorts of ways of doing this - mostly with PHP.

I tried using Python first, but ended up deciding that PHP was just a better (and simpler) solution for this. Until this week, I had no idea that PHP could be so powerful for SysAdmin type scripting. In fact, before this week, I knew very little about PHP period.

Once I started looking, I found many examples. The thing is, no single example I found worked for me (at least entirely) so I thought I'd share the script that finally did work, in hopes it could help someone else out with a similar problem.

This script assumes you have PHP with the MS SQL extensions as well as FreeTDS installed.

Here is the script:



The script accepts e-mail via STDIN, so to test the script itself you can create a 'sample' e-mail file such as this:





Then you can place your sample emailfile in the same directory as your PHP script and then use cat to pipe the e-mail file to PHP like this: cat emailfile | postfix.php After that configure Postfix to forward all mail to your PHP script, and you are all set. I'll cover the Postfix configuration in a seperate post.