Learning the Command Line

February 28th, 2007
[ Linux ]

LifeHacker posted a link to a nice little ‘Learning the Command Line‘ article. I get asked a lot to explain my obsession with the command line and why I’d want to seemingly live in the past.

While the sheer power you have is the biggest reason, the next biggest reason is it’s ubiquitousness. I could be using that word completely wrong so I’ll explain. A real example, say I need to search through a large codebase on a project. I’m looking for any mention the word “CreateConnection” in any c# file. As well, I don’t care about any file that has the word “Test” in it’s title as those are unit tests. As well, I only want a list of files. I don’t want specific references in the file, just a list of filenames as I’ll then open up those files and edit by hand. I type one line, and yes I can do type this without referencing 18 books:

find . -name *.cs | xargs grep -l CreateConnection | grep -v “Test”

Let’s not even get started on what else I can easily add to this to write the list to a file, ftp it to a network location, run this as an hourly job to update a network location, and on and on.

So does Visual Studio, or some other gui, allow me to do that? I would guess it would but I don’t care about that. Here’s why. Tomorrow when I’m working on html files while building a website, or xml documents, or txt files, or any non-binary file, I can do the same thing. I’m not bound to finding a new editor or gui that’s implemented this. As well, I can login to almost any server on the net through ssh and do the same thing. That’s powerful.

The same applies to my obsession with vi. Everything I take the time to learn in vi, I know have available to me for any non-binary file on any *nix based machine. Again, in my humble opinion, powerful.

Now I don’t plan on getting my wife or dad in a terminal session but if you use a computer for anything beyond checking email and browsing the interweb then do yourself a favour and try the command line. You will be useless at first but didn’t your parent’s tell you, if it was easy everyone would be doing it.