Tux + Linux Items

Help promote Linux and FOSS at the
Sample T-Shirt from the ERACC Cafe Press Store
ERACC Cafe Press Store

Two Reasons the Command Line Trumps the Graphical User Interface

My inspiration for this article came from reading Akkana Peck’s Intro to Shell Programming: Writing a Simple Web Gallery at LinuxPlanet today.

Before I get into this I will state for the record I am not a text mode Luddite. I use a graphical user interface (GUI) every day. In fact I am using the fluxbox window manager GUI as I write this article with a WordPress GUI and Firefox GUI. I like my GUI chewy goodness as much as any visually stimulated human. However, for certain tasks a GUI is just not the best choice.

The first reason is twofold, quickness and convenience. I will use for this point GNU/Linux distribution software installation and removal. If one has one’s distribution repositories set up, knows the application one wants to install and knows the command line string to use for installation on one’s GNU/Linux distribution of choice then installation is much faster at the command line. For example I want to install K9Copy, a DVD duplication application not included or installed by default on my Mandriva Linux system and included in the Penguin Liberation Front (PLF) third party repositories for Mandriva. From the GUI installer under KDE I have to use the following steps.

  • Click the Menu button.
  • Click “Install & Remove Software”.
  • Provide the administrator (root) password.
  • Wait for the user interface to load …
  • Wait for the user interface to load …
  • Wait for the user interface to load … finally!
  • Click File > Update media
    Because I want to make sure I have the latest repository updates.
  • Wait for the repository database to be updated.
  • Type k9copy in the search bar.
  • Click the check box beside K9Copy.
  • Click the Apply button.
  • Wait for the application installation confirmation dialog.
    Dangit! I already said to do this once, now I have to say do it once more.
  • Click the Yes button (It is okay to continue, stupid GUI).
  • Finally get the application to install.
  • Wait for the GUI to reset after the install.
  • Close the GUI.

Doing this set of actions can take several minutes. On the other hand I can switch from my GUI to a console login with Ctrl+Alt+F1, login as the administrator (root) and type this at the command line prompt:

urpmi.update -a && urpmi k9copy

Then switch back to my GUI with Ctrl+Alt+F7 and conveniently continue typing this article while the program installs. The urpmi.update -a command tells my installer to update its sources. The && tells the shell to do the next thing only after the first one completes. The urpmi k9copy tells my installer to install that application. The Mandriva urpm* tools are smart enough to know that k9copy is k9copy-1.2.3-1plf2008.1.i586.rpm. All this will run in the background while I get stuff done. Now that I have finished this paragraph I can switch back to the console with Ctrl+Alt+F1 and exit from the administrator session.

The second reason the command line trumps the GUI is repetitive tasks. I could illustrate this here with a clever shell script. However, I think I will refer to Akkana Peck’s article I mention at the beginning of this article. Go read it if you have not. In summary Akkana shows how to use a shell script loop to modify a directory full of JEPG files with two of the ImageMagick command line strings. While one could do this with a GUI like The GIMP I would only recommend doing it with a very few files. If one needs to modify a few hundred graphics to be a standard size for a web site gallery then the command line tools Akkana shows how to use are going to save the day.

I have seen all the arguments that Joe Sixpack could not care less about a command line. That is absolutely fine since Mr. Sixpack is more than likely only wanting to browse the web, play a few games, send and receive e-mail and work on his genealogy. All these can be done in GNU/Linux just fine without ever needing to see a command line. However, should Mr. Sixpack ever need to create a family web gallery for the Sixpack family using a few hundred digital photographs from a few dozen different cameras he will have a big task on his hands. Then maybe, just maybe he will see Akkana Peck’s article and find out an easy way to get all those pictures the right size for his gallery using the much maligned command line. I am certain our friend Mr. Sixpack will be very happy to see that command line example from Akkana if he ever needs it.

Please feel free to comment and provide some of your favorite time saving or repetitive command line tasks.

This article has been accessed this many times:

link to mba-online-program.com
mba programs online

Edit: as of Fri Mar 13 17:31:30 UTC 2009 the route to hit-counter-download.com is not working. If the page seems to be taking a long time to finish loading this is why. Hopefully it will clear up soon.

Share

24 comments to Two Reasons the Command Line Trumps the Graphical User Interface

  • Ken (comment #19), I appreciate your comment. Your fear is most likely from your lack of experience with Unix text mode commands. While I did very little with CP/M I did a plethora of IBM PC-DOS batch scripts and REXX scripting under IBM OS/2. :)

    Once one gets more familiar with command line usage and text mode scripts the fear factor is much decreased. Further, if one experiments with shell scripts and shell commands as an unprivileged user, not root, then one is limited as to how much damage one can do. Most shell commands are not going to kill one’s system anyway but it is healthy to be cautious until one gets more familiar with the CLI.

  • Anonymouse

    The way to get around having to return to the terminal to exit (Gene, question #5) is to do something like this:

    urpmi.update -a && urpmi k9copy \
    || mail -s “install failed” me@localhost ; exit

    Wrap all this in an alias or script, and it could be nicer (such as telling you which install failed, trivially).

  • Anonymouse (comment #22) thanks for the comment. Yes, I know about that but don’t usually do it for one off tasks like installing a single application. Thanks for pointing it out for others to see though. :)

  • [...] Two Reasons the Command Line Trumps the Graphical User Interface Before I get into this I will state for the record I am not a text mode Luddite. I use a graphical [...]