Saturday, March 7, 2009

Living on the Commandline - The Beginning

Living on the Commandline - The Beginning

I first tried out linux in 2001. I think it was RedHat 7.1. The copy I had came with a magazine. I had brought it home after work and then proceeded to load it up on an old beige box - probably an old pentium II if I recall. Much later, probably in the early hours of the morning - something I still remember now to this day - I saw linux boot up for the first time; I distinctly remember loading up gnome for the first time and watching this foreign and exotic and distinctly non-windows graphical system load itself up on my screen.

I also remember turning the machine off at the switch. After all, that's what you did with dos right? Later, I learnt you had to do: "shutdown -h now" or something similar.

There was something seriously cool and special about doing this. This software was magic. It was free software; written by people who thought it was cool to build something like an alternative desktop system; or who thought it necessary to reverse engineer all the little utilities and foundational libraries that went into defining a unix system; or, most importantly, who thought it cool to actually build a new operating system (technically what is called the "linux kernel" here) which rock solidly ran all of the above.

It was like opening up a whole new universe. I've never looked back.

One of the powerful things about linux and unix in general is its commandline or shell. There is a philosophy and an ethos behind it, magically summed up in the 'Unix Programming Environment' and other such books.

I've struggled to clearly lay out why I think the commandline is so important and I suspect I shall fail here also. Anyone who runs a server (especially a non-Windows server) would understand. It is the power of knowing the name of the thing you want to access and being able to use it in ways that perhaps the original author did not conceive or intend; being able to combine it with other similar commands in a high-level program called a "shell script"; being able to invoke it at a future date in the early hours of the morning whilst you're safely tucked in bed... whatever. Knowing the "name" of a thing allows you to build and do your own things.

GUI (graphical user interface) programs and the commandline don't necessarily compete or intersect - insofar as the GUI is used for desktop applications, that is. No one would want to run Excel or Illustrator in some piecemeal way from the commandline via a series of written commands (although they might have reason to run an excel-like application in a terminal where the shell normally lives). [And of course, Excel has it's own built-in "shell" of a sorts - visual basic for applications - which allows you to script excel actions.]

Nonetheless, having only graphical applications at your disposal is a bit like being confined to a padded cell; a pretty cell with shiny, different coloured walls and flashing lights; but, a cell all the same - constructed for your imprisonment. Having the command line - knowing the "names" of things - allows you to drop out of this confined space into a more open world where you can build almost anything you want.

A well designed gui of course is a great thing indeed; such a thing is unfairly likened to a padded cell. But a mediocre or poor gui... well, it doesn't bear mentioning. Perhaps the thing I object to, is using a gui for everything; that is a great weakness; it limits your capabilities; it reduces your ability to extend yourself into the world and fully control it. I need to add that for normal everyday users, this power is not needed; I'm referring more to people who use computers to run or build services and programs.

Well, I've ranted enough. But now that I've said that, I'm going to post some follow-ups on some of the things I've learnt to do with the commandline.