Why Command Lines Won’t Die

In a recent email discussion with friends, it was asserted that command line programs are not only old fashioned, but also pointless. The underlying thought is that if you can do it with a GUI, why would you want to do it with a command line? Surely command lines are arcane, slow and complicated. As someone who writes and uses command line software every day, I feel compelled to defend them. Many people use and enjoy command line programs, and will not need convincing of their advantages, but many others seem to have written them off entirely, to the point that they will not touch worthy and useful software that happens to have a command line interface. Here is why they’re missing out.

  • Typing commands can be faster. For instance, I can type “find /usr -name *.txt” faster than I can click on start, select find find files, wait for the find dialog to open, select “Browse Directory”, browse to “/usr”, and type *.txt into the name box.
  • There is a lot of good command line software about that it would be silly to just ignore. My favourite is wget. You can type “wget -r http://www.website.com” to download an entire website into a local folder. I use it to put websites on my PDA. And because it’s a command line program, and command line programs are portable, it runs on my PC (Linux and Windows) and on my PDA. There aren’t many GUI programs about that run on all three. Also, I can write a shell script that will download all my favourite websites in one go.
  • It’s quick and easy to write your own command line software. You can use C, Perl, or just shell scripts. You don’t have to learn a GUI library to do it, and you don’t waste time laying out dialog boxes. I write command line programs all the time at work to do all kinds of things, like testing the embedded software I write. At home I have scripts that do things like back up certain files.
  • Command line programs are extensible. You can combine them together by piping their outputs into the input of another program, or by calling them from script files. For example, I wrote one program that could send serial port commands to a rack mounted box I was testing, then I wrote a series of batch scripts that would invoke various commands. It ended up being very powerful and solving lots of problems that weren’t forseen when it was written.

I’m not suggesting that command lines are the be all and end all. There are some things I wouldn’t want to use a command line program for: Reading email, browsing the web or writing this weblog. Anyone who only uses their computer for email, web browsing and writing weblogs is free to disregard all of the above.

Comments are closed.