Why the command-line interface is overrated

Martin tH
Martin tH
Apr 16 · 6 min read

Think back to a particular day on which you made heavy use of the command line. Were you able to recall the commands and arguments from your memory? Or did you have to brush up by looking at the documentation repeatedly? If you’re like me, then it’s probably the latter.

Weaknesses of command-line programs

Fact is, we humans are not good at memorizing sequences of characters without visual cues. That is why tools with a graphical user interface (GUI) are so much easier to get started with. A well-designed graphical tool will direct the user’s attention to the most important or relevant information. Also, it guides the user through different screens to help them with their task.

Compare this to command-line interface (CLI) programs which, in the worst case, require the user to know the commands exactly before using the tool. That said, there are some command-line tools available that offer a pretty advanced user interface by using ASCII characters to draw up the visual components. Examples of this are Midnight Commander and vtop.

vtop — a graphical activity monitor for the command line

However, for the majority of command-line programs, we are stuck with the traditional “type a command, get a response, and repeat until you are done” paradigm. As result, you will probably find yourself consulting the documentation a lot at the beginning. To wrap your head around the various commands and options simply takes time. And what’s more, if you take a long break from using the tool, chances are you will have to refresh your memory the next time you use it.

Most CLI programs come with a user manual. But these can lengthy and too detailed for a beginner who just wants to know how to solve their problem quickly. It is clear how much difficulty users can have with learning a new CLI tool, if you look at the large number of StackOverflow questions asking which exact commands to use. While it is often clearly described in the tool’s documentation.

Not only can users spend a significant time browsing the manual and the web, but it also distracts them from their task. And this notable because in order to work optimally you need to minimize the number of context switches and breaks.

Command-line programs also lose in this regard, as they generally require more cognitive effort to use than their graphical counterparts. That is because converting your intent to the right command can be quite puzzling, even for more experienced users. Graphical programs require less mental energy since it is easier to associate visual concepts like colors, fonts, icons, and layout to their intended purpose. And don’t forget about tooltips, dialog boxes, slide-in panels, images, animation, and diagrams as well.

User experience dictates for a large part how your program will be received. Photo by Kelly Sikkema on Unsplash

But what I think is the biggest drawback of CLIs, is that they don’t make it obvious which functionalities are available. Only by reading the manual can you find out what the program is capable of. (Though like I said before, there are exceptions of tools that do offer selection menus or autocomplete). GUIs, on the other hand, solve this problem by presenting all the available functionality through menus, windows, and other visual elements.

Knowing the right command doesn’t mean you will have a painless experience using a CLI tool though. As you can still make typing mistakes, with potentially dire consequences. Command-line tools tend to have fewer safeguards in place to prevent you from making grave mistakes, like wiping part of your hard disk or accidentally restarting a production server. That is because the most powerful commands are usually also the simplest.

When a command-line interface makes sense

I am not saying that command-line programs are inherently bad. They certainly have their use in a good number of cases. In the case where a system doesn’t provide a desktop environment for example. Like when you need to use SSH to make a change on a server VM. In those cases, you will need to resort to command-line tools like vi to edit text files or rsync to synchronize files between computers.

Another reason to opt for a command-line interface is when you want to minimize the consumption of computing resources. Since graphical applications are much heavier to run, they are usually a bad idea for performance-critical systems like servers. If you’re trying to shave off every bit of processing overhead, the graphical front-end is often the most obvious to remove.

It’s also different when you expect your program to be mostly used by tech-savvy people like software developers, system admins, or informatics scientists. That user group is generally much more comfortable with the command-line, and some even prefer it over a graphical tool. Besides that, Linux and macOS users tend to be more familiar with the command-line than Windows users.

When you plan to support automation, then it also makes sense to go for a command-line interface. If the program can be executed with a text command, then it can be run as part of a shell script, alias, cronjob, or in the background after a specific event. The UNIX philosophy actually advocates for programs with a single clearly-defined purpose and which operate on standard input/output. The benefit is that multiple programs can be easily chained together to achieve more complex tasks.

A pipeline of three programs run on a text terminal. Diagram by XcepticZP https://commons.wikimedia.org/w/index.php?curid=11524651

Another thing to consider is development time. CLIs are usually quicker to build because you don’t need to think about the layout and style, as you do for GUIs. For this reason, I usually go for a command-line interface for small utility programs.

And you shouldn’t just think of the initial development time. But also the additional time spent on porting the program to different platforms. There are fewer differences between the shell languages on different operating systems (e.g. Windows has cmd and PowerShell, and all UNIX-like OS’s have bash), than between the GUI frameworks. For that reason, command-line programs can be more portable as well.

Best of both worlds

Even though there are some proper benefits of a CLI, I still believe that a GUI gives the users a far superior experience. Anyhow, you don’t need to choose. Because you can also consider a hybrid approach by offering both. In a way, that is really the best strategic choice, if you have that luxury. Because by doing both, you can support the largest number of use cases.

In fact, many programs start off with a command-line interface before receiving a GUI. Because the CLI offers bindings that can be used by the user-facing front-end, this is a sensible strategy. An example is git, which started as a command-line application. But as its popularity grew, many graphical front-ends popped up like Git GUI, SmartGit, GitKraken, and Sourcetree.

In the end, the decision of whether to develop a CLI, GUI, or both is mostly situational. So if you don’t have the time or resources to develop multiple user interfaces, pick one that makes the most sense for your current situation.

Sources:

https://ieeexplore.ieee.org/abstract/document/6297188

Nerd For Tech

From Confusion to Clarification

Nerd For Tech

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/. Don’t forget to check out Ask-NFT, a mentorship ecosystem we’ve started

Martin tH

Written by

Martin tH

Nerd For Tech

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/. Don’t forget to check out Ask-NFT, a mentorship ecosystem we’ve started

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store