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 programs online

Edit: as of Fri Mar 13 17:31:30 UTC 2009 the route to 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.


Published by

Gene A.

Gene is a "Unix Guy", network technologist, system trouble-shooter and IT generalist with over 20 years experience in the SOHO and SMB markets. He is familiar with and conversant in eComStation (a.k.a. OS/2), DOS (PC, MS and Free), Unix, Linux and those GUI based systems from Microsoft. Gene is also a follower of Jesus (forgiven, not perfect), and this does inform his world view.

24 thoughts on “Two Reasons the Command Line Trumps the Graphical User Interface”

  1. I use GUI in the article for all things graphical that provide a user interface. So, GUI means graphical “desktop” or window manager and graphical applications. Basically anything the user interacts with on a monitor, that is not a pure text mode interface like the Unix console, is a GUI.

  2. ‘Then switch back to my GUI with Ctrl+Alt+F7’

    Don’t forget to close root session before 😉

  3. Debianero (comment #4), thanks for the suggestion. The problem is the installation application was still running at that point. If you read further you see, “Now that I have finished this paragraph I can switch back to the console with Ctrl+Alt+F1 and exit from the administrator session.” 🙂

  4. I am a luddite!! I really wish we have NEVER moved away from the good ole terminal. Why waste all of these fabulous CPU cycles on more and more bloatware?

    Why is point and click faster than b, etc. As long as the application interface has user friendly keys, why do we need a GUI layer at all?

    I remember the good ole days of QEMM Deskview (think the spelling is correct). My shiny new x64 Dual core notbook runs basically the equivalent with Windows or KDE as the good ole 386 with a multi-tasking cut and paste terminal program.

    Is GUI really worth it? We had Menuing systems under DOS with shortcut keys as well. GUI attracks users with pretty pictures but does not equate to more functionality and has a much higher cost.

  5. Text scripts serve as a log of actions you consider important (the cream being that you can rerun them.. or modify and rerun.. to your heart’s content).

    Text scripts, once created, can be attached to your favorite customizable gui (to get the best of both worlds.. for scripts you really like and want integrated into a gui).

    “Joe Sixpack” will get smarter by using Linux.. because Linux begs to be moved along more efficiently with every secret incantation you discover.

    The power of text based automation becomes clearer the more you step into that world of programming. In the limiting case, you will be writing code to define your new platform. Visual tools *enhance* text because you can use visual clues (the picture dimension) to more easily remember things. Also, for trying things out, it’s more efficient to move a mouse than to retype text with coordinates or call up a huge number of short-cuts. But most power is from text.

  6. I love eye candy but I can’t leave without a console. I use Yakuake to have it drop down at any time with just hitting F12. What are my most used console commands? Hard to say, here are a few of my favorite command liners which I use for personal use (at my workplace I use lot of others):
    – I made a simple entry in my .bashrc and defined an alias “mdvup” it updates my system (yes, Mandriva), see my website for how to do it (the text is in Romanian, but you’ll be able to find the code).
    – mplayer … I love mplayer. I listen to online radio only with mplayer from command line. Why run JuK or AmaroK to listen to a radio stream?
    – every time I want special features for some movies, I use mplayer from command line, it’s easier to specify tricky parameters. For some files (ie. .mkv with x.264 codec) I specified at the file association in KDE a lot of parameters, so I use VDPAU to decode HD videos. Now, it works with clicking on an .mkv file, but in the background it is a carefully constructed command line.
    – quick file management over multiple hosts. I use a lot sshfs to mount remote folders, than mc to manage the files. Rarely I use directly the scp command, because it’s faster if the remote folder is mounted somewhere.
    – when I have to look for logs, I never use MCC GUI. Just tail -n XX /log/file and if there are lot of stuff a grep or sed to filter the output.
    – ps aux is superior to KSysguard’s list, top and kill are handy too.
    – quickly check the network status … ifconfig is the fastest way.

    Beside these, I have lot of little scripts (bash, perl, expect) to easy my everyday life.

    I just love GNU/Linux.

  7. I am a big fan of Yakuake, a drop down terminal for KDE. Likely very similar to Guake, but it is for KDE so it has options and features and whatnot.

  8. You are quite right that IF you have repositories set up AND IF…AND IF… and you know the proper command, it is faster to use the command. But if all those conditions are just geek-speak to you, you have to factor in all the time it would take to figure out how to get all that stuff done, and then do it. In the total picture, GUI wins. For the repetitive tasks, of course, the command line can’t be beaten.

  9. I am forced to use Windows as my desktop at work, despite the fact that all my productive time is spent in xterms, ssh-ed into some of our many Linux servers, doing CLI work.

    The GUI (here exemplified by Windows) often just gets in my way. Case in point: I receive daily, from a data aggregator, multiple emails containing data I need to put into a database for our application programmers to read. So every day, I have to go through a bunch of emails, in Outlook, clicking on each email, right-clicking on the attachment, select “Save as” from the popup menu, drill down to the folder I want to store the message, click “Save”, and repeat for all like messages.

    Fortunately, my CLI FTP tool lets me just “mput *” to move all these files to the Linux server where I can work on them. Once there, I have written a shell script to normalize and manipulate the data, then write it to the database. I spend more time doing all the GUI “clicking” than I do with the rest of the job.

    I know there are 3rd-party tools available to let me script all the attachment saves, but 1) I don’t want to spend the money, and 2) our data aggregator is switching to a web-accessible (via SOAP) database system, instead of emailing lists to all their customers. So, soon, I will have one script that will run from my Linux server, that will access their website, download the days transactions, manipulate the data, and save it to our database. And with a cron job to call it once a day, I will only need to personally deal with it when something breaks.

  10. Paul (comment #6), you Luddite! 🙂 There was a move away from the command line (CLI) to make things easier to do for the technically challenged computer user, like Mr. Sixpack. The problem is Microsoft’s attempt to completely obfuscate the CLI has kept users of those systems from learning the power of the CLI. Many Microsoft refugees are fearful of the CLI as a result. Of course Apple is guilty of this too. But at least Apple now runs on top of Unix and has an excellent command line underneath the pretty facade.

  11. Patkos (comment #8), thank you for your comment. I did look at your page. The AutoTrans plugin for Firefox got it translated “good enough” for me to understand by passing the page through Google translate. You have some good information on there.

    Anyone wanting to see Patkos’ site, click on his name.

  12. Steven (comment #10), thank you for commenting. I am an advocate of actually learning the commands one would need to know to get updates or install new packages at the CLI for a distribution. Even with the GUI package managers one still needs to know the name of an application in many cases.

    I strongly advocate that if one is the “administrator” of one’s own GNU/Linux PC one should know how to use a command line text editor as well, such as vim. One does not need to be a “vim guru”. Just know that “i” is used to begin to insert text, “Esc” stops inserting, “d(space)” deletes one character under the cursor, standard arrow keys move around in the file, “:w” writes to the file being edited and “:x” will exit with save of the file being edited. There are a plethora of other vim commands but these will do for the times that the GUI won’t come up and one needs to edit /etc/X11/xorg.conf to get it working again.

    New users, ignore the calls to use emacs. While emacs is a great operating system it really needs a decent, simple text editor. 😛

  13. Padma (comment #11), thank you for that comment. I do not understand how pure Microsoft administrators cope without using a CLI.

    Of course, I am advocating that the average user get familiar with the CLI on GNU/Linux. At least for a few things that will be needed if or when the GUI breaks and the CLI is all they have. Or for repetitive tasks like the example mentioned, resizing of many pictures for a web gallery.

  14. Another VERY POWERFUL feature of the cli is that it is far more explicit and unambiguous. Try explainging installing software using a GUI tool (and I mean ANY GUI tool) to someone over the phone. Then repeat the process using a command-line tool. There is no comparison.

  15. I agree that command line is faster and better for a lot of things. I just never had the inclination to spend the time to learn the commands to the point of being good at it. It’s not much fun when you have to look up every command and mull it over to be sure it’s correct.

    Also, I have a fear of doing irreparable damage to my system without realizing I have done it and having no idea how to recover. I guess I will remain a slave to gui. 🙂 The last command line stuff I did to any extent was with CP/M and DOS. I guess that dates me, huh?

  16. Wes (comment #18), thank you for your comment. I have explained how to use a GUI and CLI, both over the phone. I agree that explaining a command line string is much easier.

  17. 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.

  18. 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).

  19. 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. 🙂

Comments are closed.