Yet another Linux story

This article is aimed at Linux newbies, enthusiasts and developers who are yet to take the plunge.

A big task was pending since a very long time in my todo lists. It was installing and trying out Linux. Having heard about many features and praises about Linux and programming on the LAMP stack from a few of my friends and colleagues, I decided to give it a try myself. So I went about learning and researching Linux & LAMP, formatted my hard-drive, created new partitions and installed Ubuntu 11.10 (a variety of Linux that ships with the GNOME desktop environment). The first emotion I then felt was that of regret – Why didn't I do this earlier? Why was I focused on programming in a closed-source OS environment with bloated software, and a runtime with just two options to code – VB.NET & C#. Being enlightened about the open-source legends and milestones achieved by Linux and the secure way it handles its file-system, I couldn't help but wonder at its marvel.

[Part-1]: What is Linux and LAMP: Linux is a unix-like operating system developed on open-source model. Without going much into its history (you can find it here anyway), suffice it to say that it was an experiment started in the early nineties by Linus Torvalds, its inventor. Since Torvalds made the Linux source-code open on the web, programmers all around the world started contributing to it, and Linux naturally evolved in time to become what it is today. Below are only a few of the advantages of using Linux.

[i] Security and Stability: Having several years of Unix heritage behind it, Linux is known for its security and robustness. That is because, unlike Windows, Linux was designed for security. In a Linux file-system, there is only one root user who can control the system and perform administrative tasks such as installing and removing software. All other users, will only only have privileges to their individual folder. So, even if someone writes a virus or malware program for Linux, the average user running that program won't have any rights to perform any real damage. Contrast this to MS Windows, where a user is free to download and install any bloated software downloaded from a third-rate website, and thus manage to infect his system without even knowing a thing about it! No, in Linux only administrators have that privilege, and they are wise enough to know how to use their privileges.
Another reason for Linux's security and stability is its modular architecture. Linux is not a full-fledged OS, but is the kernel or core of an OS that consists of low-level functions like memory allocation, device management, swapping etc. For high-level functions like the Desktop environments, application software, etc. there are modules or packages which run separately from the core (more about this in part-2 - How Linux Works). So, even if a Linux Desktop crashes altogether due to any reason, its core would still be running and you can recover yourself by using the console commands.

[ii] Quality: Because Linux is an open-source product, all development and bug-fixes are done in front of the masses. These masses include the best of programmers who commit their code in the Linux repository, Technical writers who contribute by writing Linux documentation, and beta-testers who test the latest Linux OS and raise faults on the bug-tracker.
For those who don't know how open-source works, it is very important to get an overview at least. Nowadays since we are using the freely available open-source software such as Subversion, Nunit and Open-office even in corporate environment, it helps to know how their development takes place and whether any new features, or a new software consisting of better features is around by. For competetion and alternatives is what we get from open-source. The principles of open-source hold that all software should, not just be free for everyone's use, but also be alterable (in other words, freedom to use, freedom to change the source-code and freedom to contribute it back!). One advantage of this is that a large user-base will cause a contributing community to thrive and the software quality to improvise and evolve. For more information, visit this Wikipedia link.
The L in the acronym LAMP stands for Linux. The rest are three of the most popular open-source packages that complete a web-developer's toolkit on the fly. These are:
  1. Apache httpd, the web server.
  2. MySQL, the database.
  3. PHP, the scripting language (though it may also stand for the languages perl & python).
[iii] Flexibility: Linux is very flexible due to its modular architecture. For doing almost anything, there is usually more than one option available. For instance KDE, GNOME, LXDE and XFCE are some of the popular desktop-environments in Linux. When you install Windows-XP, there is only one Desktop which is the one provided by XP. But in Linux, you may install as many desktops as you want and depending on your need and performance requirements, switch to one or the other at will. Imagine doing that on a Windows OS! Not only that, any Linux program will run on all desktop environments equally well – you can mix and match.

[Part-2]: How Linux Works:
As explained in the previous section, Linux is not an OS in itself, but the core or kernel of an OS. In fact, this modular architecture of Linux proved its worth so much, that it inspired many other systems. Open source software such as the Firefox (a web-browser) and Eclipse (an IDE for development) follow a modular architecture with a strong core and a set of plug-ins for specialized functionality.

The Linux technology stack could be seen as follows:

The Linux Stack & File-system.

 The Linux file-system does not have drive letters to individual drives and partitions such as C:\ and A:\. Instead, all files and folders in the file system are logically inside the root folder represented by “/” and physically they could be anywhere. Furthur, a user's home directory could be “/home/user1” and your DVD contents could be found in a folder like “/media/dvd123”. The benefit of this file system is that it does not limit your root directories to the 26 alphabets of the English language, but allows you the flexibility to create as many root directories (provided you are the root user), and mount as many partitions to the folder of your choice. In Linux, the process of binding a folder to a specific storage partition is called “mounting”.

Another reason for Linux's stability is that Linux uses a Journalizing file system such as ext3 or ext4 to store data. The advantage of using a journalizing file system is that changes made to the files and folders are not immediately written to the disk, but are written in batches. First of all, this creates a very efficient system of writing to disks since access to disk memory is much costlier than physical memory. Secondly, it never leaves the system in an inconsistent state in case of failures.
Compared to this, windows systems are based on FAT32 or NTFS file systems that write to disk as and when changes occur. Hence, they are very prone to data-corruption when failure occurs. Another problem caused here is that windows file systems tend to bloat over time. This happens because since changes are saved to disk as they are made by the user, the bytes get stored at different places on the disk which causes fragmentation. So the next time your word-document is opened, Windows has to collect all its bits and pieces from different areas of the file system causing inefficiency over time. Hence, a windows system needs de-fragmentation to be performed after a certain period's use. In Linux, there is no concept of de-fragmentation as this inefficiency is not introduced in the first place.

[3] Linux Distributions: As noted earlier, Linux is not an OS, but the kernel of the OS. This allows the flexibility for a variety of customized OS distributions consisting of the Linux kernel and individual packages as per the distribution's requirement or intended use to be developed, and still be compatible with each other. Linux is used in devices ranging from cell-phones to super-computers, but each distribution is packaged and customized according to its own requirement. Yes, even Android is a specialized distribution built on the Linux kernel. For general use such as running desktop applications, surfing the net, playing music (and of course programming!), there are many popular open-source distributions available such as Debian, Ubuntu, Fedora, etc. They are all Linux, just different flavours! The full list and information is available on Installing them is relatively easy, depending on the distribution you select. It typically involves downloading the latest version of the distribution and burning it to a bootable disk.

[4] Linux for Developers: As I mentioned in the first paragraph, the world of open-source is open for developers. This is often expressed in the form of the much popular acronym LAMP. However these are only four of the gazillions of packages offered by open-source world. Having said that, these four packages together constitute a development environment to create any powerful web-application in the world. Wikipedia and Google were developed using just these four!
Apart from providing a myriad of language compilers and interpreters ranging from ada to c++ and java to zpl all for free, open-source also has a ton of other software. A few of them are listed here:

IDE: Eclipse, Netbeans, Ajunta, Mono, Pythoncard.
Text editors: Vim, gedit.
Repository management: subversion, git, mercurial.
Testing: Nunit.
Compilers: GNU compiler collection including c, c++, perl, python and many others.
Databases: MySql, Postgre-Sql.
Web-server: Apache httpd.
Scripting: PHP, RoR.
Package Management: Synaptic, APT.

Screen-1: Ubuntu 11.10 Unity Desktop based on GNOME - comparable to XP/Win7.

Screen-2: Disk Utility: A Linux program showing the details of various disks and partitions on the system.

Screen-3: The Linux File-system being explored using Nautilus – The File management program for GNOME.

Screen 4: gedit – an open-source text-editor similar to notepad, but with tons of more features.


tracy said...

I was a Windows programmer, VB5, VB6 then C#, from 1997 to this year (2012), VB5. In fact Jan 31 2012 marks the last time I used Windows, in fact I removed the last copy of Windows from my computers on that date.

I can do everything I want on a Linux desktop (currently Linux Mint 12 KDE. In fact I can do everything I used to do on Windows , on Linux. I installed the latest version of Mono/MonoDevelop, and with that i can continue to program in C# and develop ASP.NET web applications, which I can also host on Linux servers.

In addition I am a a Musician, and I have been able to build a small portable recording studio, using nothing but Free software, a Linux operating System and Linux compatible hardware.

Windows is simply an unnecessary cost, both in time and money.

I use Ardour, Audacity, Hydrogen, Rosegarden and various other Free software applications.

Connie said...

A detailed introduction, thanks. This is certainly needed. Most people just tend to skip this bit and assume knowledge on the user or are in so moch obfuscated detail that users are instantly put off...well done. One thing you may like to try is a ready to swallow solution is XAMPP, which will allow a quick and easy (L)AMPP solution in one single download. Used with a Puppy Linux, it provides a total LAMP server setup that is easy to configure and boots from a USB stick. But that's by the by; very good article

Akari said...

Very nice article, but you got the part about "what is linux", the history, wrong.

Linux is just the kernel of the OS, useless by itself. The OS should be called GNU, or GNU/linux, never "linux" by itself.

The project for this OS began much earlier, in the 80's

Please take a look here:

Prahlad Yeri said...

@tracy - Same here. I had learned programming with 4GL Foxpro in 1998, then went on to bang my head against things like VB6, Oracle, Access, MS-SQL and the like, finally making peace with VB.NET and C# - I still have to do it as it is my full-time job:-(.

@Connie - Thanks for the appreciation!

@Akari - I appreciate the fact that GNU project began much earlier than Linux in the mid-80s, and that several GNU packages such as gcc, gtk+, etc. together form the heart of a modern linux distribution. But they are still packages and not a complete OS.

However, if we talk about the Linux kernel or the OS, destiny had to wait until the year 1991 when enthusiastic Linus wrote an alternative to minix OS and shared it with the world. His mail could still be found here. The rest as they say, is history!