Is It Time for the Command Line to Ride Into the Sunset?
Nov 22, 2012 5:00 AM PT
This story was originally published on June 28, 2012, and is brought to you today as part of our Best of ECT News series.
There are many topics that tend to come up in a recurring manner around water coolers throughout the Linux blogosphere, and not just the great "Year of" debate, either.
No indeed, another shining example more than a little familiar to most of us who spend any time here is the much-abused command line -- specifically, whether it's outlived its usefulness in this era of the GUI.
Well guess what? The debate is back!
Trusty or Crusty?
That's right -- "Is the command line a crusty old relic?" was the name of the Open Ballot posted recently by the excellent team over at TuxRadar, and the conversation hasn't died down since.
So what shall it be? Has the command line interface outlived its usefulness? Or is there still a place for this trusty old tool?
Linux bloggers haven't held back expressing their opinions.
Pretty vs. Powerful
"The Command Line is far from being a crusty old relic," opined Google+ blogger Linux Rants, for example. "It still holds more power and versatility than can be found in any GUI on the planet."
It's true that "GUIs are pretty and have great eye candy," Linux Rants conceded. "They make computers easy to use for people that don't want to actually get to know their computer, but they hold only a fraction of the power that you can get from a command line."
GUIs are also significantly slower to use, he added: "Just the simple task of separating two kinds of files from a single directory, 'mkdir GIF;mkdir JPG;mv *.gif ./GIF;mv *.jpg ./JPG' and I'm done -- five seconds to accomplish that. How long would it take in a pretty looking GUI?"
Long Live the CLI
Indeed, "as soon as someone shows me a way to efficiently construct a for-next loop in the GUI that lets me manipulate a series of files in a particular set of ways, I'm there," agreed Hyperlogos blogger Martin Espinoza. "Until then, there's bash.
"Cute pattern-renaming tricks in file managers just don't cut the mustard compared to being able to use xargs, sed, tr and so on to allow one program to act on the output from another program, and having to use a whole bulldozer when you just want to reinvent the wheel slightly doesn't make any sense, either," Espinoza added.
"The CLI is far from dead, and nothing can beat it for complex tasks," echoed consultant and Slashdot blogger Gerhard Mack. "Even Microsoft has realized that and pushed a better command line for their servers for the last few years."
The Right Tools for the Job
Chris Travers, a Slashdot blogger who works on the LedgerSMB project, took a similar view.
"Saying that GUIs obsolete CLIs is like saying word processors obsolete Emacs or VIM," Travers opined. "They are different tools for different jobs."
Travers sees it as a matter of information density.
"A GUI is very good at providing dense info to the user, but very poor at receiving dense info from the user," he explained. "A CLI is a bit more rounded but will never be as good at providing dense info to the user as a GUI is. Where it really excels is in receiving dense information from a user."
Case in point: "Imagine how many mouse clicks and keyboard strokes it takes to tell a GUI ftp program, 'download file.txt but into myfolder, not the current local directory, and rename it to myfile2.txt,'" he suggested. "Last time I tried this it was at least 8 clicks plus typing."
In a command line ftp tool, on the other hand, "you just type: get file.txt myfolder/myfile2.txt," he pointed out. "Much easier, and the typing better flows from thought."
So, "there are many tasks, including many sysadmin tasks, where GUIs do provide better tools," Travers concluded. "But there are many more areas where keystrokes are just a better way to tell the computer exactly what you want done.
"Just as surfing the web in elinks (a terminal, text-only browser) can be a bit painful, so too can managing computers at the GUI be needlessly painful," he said.
For Geeks Only
Roberto Lim, a lawyer and blogger on Mobile Raptor, wasn't convinced.
"Using the Command Line evokes a sense of pride, so I expect to get flamed by your readers," Lim told Linux Girl. "But I have to admit, I usually wind up typing commands from a guide without fully understanding their import."
The Command Line Interface has its uses, Lim acknowledged, "but no piece of technology targeted at the consumer market should ever require that something be done via CLI; keep it as an option or you can take it out all together.
"If it is there, it should just be there for the IT people or tech support to use when you encounter a problem," he opined.
Put another way, "it is like creating a website via gedit," Lim concluded. "It's cool. But in this day and age, who really wants to type '< P >' instead of just pressing the 'Enter' key?"
So, "is it a 'crusty old relic?' Most people do not even know that it is still there," he added.
Not a Desktop OS
Slashdot blogger hairyfeet took an even stronger view.
"YES YES YES!" hairyfeet began. "There are only TWO reasons to use CLI -- repetition and scripting -- and how many desktop or laptop jobs require writing scripts or repeating the same actions constantly? That would be pretty much none, which is why I say as long as CLI is the dominant way to do anything in Linux, it is a SERVER OS and not a Desktop OS."
To wit: "If you think Linux is ready to take on the desktop, then accept my challenge," hairyfeet said. "Take ANY distro and REMOVE CLI for a period of one year. Make your OS behave as does every actually modern OS does on the planet.
"Sadly I doubt you'll even be able to get most Linux distros to boot at all without Bash or some other shell," he predicted. "It has become such a crutch for everything that I doubt you'll even get to a desktop without it."
For Some, Priceless
That view, however, was far from undisputed.
"BASH commands and scripts are a wonderful tool for system administrators," blogger Robert Pogson offered. "Few others users need to bother with them."
That said, "such things may be crusty, but they work very well," Pogson opined. "I can type a command and check the time on every machine on my network, or update software, or add a particular application to a particular list of PCs or all of them.
"That's priceless," he added. "Gold and diamonds are ancient, too, but they are valuable."
Lingua Franca of Linux
In fact, "one thing that I find valuable with scripts and commands in GNU/Linux is that with hundreds of distros, it's all but impossible for a system administrator to be conversant enough with all the distros to do all the basic operations without commands and scripts," Pogson pointed out. "The same goes for helping novice system admins or remotely administering a PC."
So, "I like to call that language the lingua franca of GNU/Linux, covering all distros on all PCs with any installation," he said. "A Debian guy can help a Red Hat guy or vice versa, even if one uses GNOME and the other uses Xfce.
"Can an XP guy help a '7' guy?" Pogson added. "Maybe. Maybe not. Can a Debian Sarge guy help a Debian Squeeze guy? Yes. Commands are the right way to do IT. It's a unifying force in GNU/Linux."