This is the second part of a series of posts on the Power of the Command Line. (The first post was: The Command Line in Linux, Mac OSX and Windows)
The lesson of today’s post is: Don’t be a chump, learn to love the command line!
Let’s say you have a folder full of images you just downloaded from your camera, but they are all full sized and uncompressed jpegs. You want every image to be a maximum of 640 pixels wide and 50% compressed jpegs so you can send them to your grandmother. There are 1,112 images. Well, copy them into their own directory, Open the command line, move to this directory, and type:
mogrify -resize 640 -quality 50 *
You are done. What could possibly be easier than using the command line?
One of my favorite day to day examples of using a command line applies to killing software. Have you ever been in a situation in Windows where you know some program is still running, with or without some visible trace of it, and you just want it to stop? For “applications” (whatever that means exactly) you can close the application using the task manager, just a few clicks away. But if the thing that is running is a “process,” not only is it going to be on a different list which is much longer and harder to find things on, but it will be given some esoteric name that you don’t recognize. And then, when you try to kill it the machine might give you crap.
In Linux, you open a terminal, and type in a simple command and the process becomes truly dead. In Linux you have a concept of the command line (even if you only rarely use it) and because Linux programs are all processes (there is not some quirky distinction between things that are “programs” and “not programs” as there seems to be in Windows). So, likely, you know the name of the process you want to kill, and you know how to kill it. Sometimes I just want to close Firefox. I’ve got 15 windows open across four desktops. I could go find every one and click on the little ‘x’ in the upper right hand corner. Or I could find each window and hit alt-F4 to close each window. Or, I can whip out the command line and type…
killall firefox
…. and it is done. In what way is it possible to suggest that this simple, easy to remember and use command, is not scads better than the other mousy-clicky options?
So for many processes, ALL systems have a need for a command prompt, and all three of the systems under consideration do in fact have a command prompt, even if those who feel somehow that having a command prompt is a flaw chose to deny it. When the command prompt is used is partly a matter of strategy, not requirement. If never, ever being required to use the command prompt is the standard for an acceptable operating system, then there are no acceptable operating systems. If there is some magic standard of how often a user needs to use the command prompt before that is acceptable … well, I have two things to say to that assertion. First, that is not fair play. That is a moving target. Don’t give me no stinking moving targets. Second, if you draw the line to include, say, Windows Vista but not Linux running Gnome, then you are probably also drawing the line to exclude Windows XP and all other earlier versions of Windows as being “not acceptable.” Think about that for a second.
Now, moving on to level 5 in our previously introduced framework for computer funcitonality: I find it interesting that scripts can be written in Linux routinely, and that scripts are actually expected in Linux, while in Windows, to run scripts you first have to install a special system the emulates Linux. But, the average user does not care about this and in fact will recoil at the idea, and will never really do it. (I don’t count Visual Basic as a scripting language, but you can if you wan to. Good luck with that.)
However, if you are an average user, there are things for you to consider.
For example, think of the tech support people upon whom you sometimes rely. Even though Linux is a much more powerful and adaptable system than, say, Windows (I know, that statement will cause a fight, but bring it on!) it is actually easier to obtain a high level of expertise with Linux than it is with Windows, and once that expertise is obtained, it is easier to figure out what is going on in a Linux system than in a Windows system. There is a simple way to prove this. Watch a bunch of broken (software-wise) Linux computers get fixed, and watch a bunch of Windows computers get fixed. Then, compare the following numbers:
i) The relative frequency of “wipe and reinstall” procedures that ultimately were implemented to fix the system. The answer will be: In Windows, this is routine, in Linux, this is not done; and
ii) The relative frequency with which the “expert” once given a shot of truth serum, says “Oh, it just started working, and I’m not exactly sure which thing I did made that happen” vs. “I did this, and here’s the text based configuration file for some part of your system before and after so you can see what I did and do it again if you have to.” With Windows, it is routine to “fix” something and have no idea what really happened. In Linux, that happens some times but usually there is an explanation for what happened, it is easier to figure out, and it can be replicated. When one “fixes” a Windows system, one obtains an elevated sense of magical power. When one “fixes” a Linux system, one learns something new.
Putting it another way: Consider two kinds of cars, A and B. For Car A, you know that almost all mechanics can easily fix it. For Car B you know that fewer than half of the mechanics can fix it but will try messing with it anyway, and if they break it they’ll just tell you to get a new car. Remember: This hypothetical difference is intrinsic to the cars, not the mechanics. So, which car are you going to by, all else being equal?
Another issue for “regular” (non-expert) users is this: There may come a time when you would like to automate, or in some other way fiddle, with your work flow. If you are a photographer and you regularly do certain processes to download, alter, back up, resize, etc. your pictures from the digital cameras you use, you might find out that a few hours a week (which will add up over the year) can be saved by having these steps automated, and it might be worth hiring someone to do that for you. If you do such automation in Linux, it will be cheap and it will work well. If you do this in Windows … well, good luck with that.




