DEV Community

Dave Swersky
Dave Swersky

Posted on

In Defense of the Command Line

command line terminals

I’m old enough to remember when the only way to interact with a PC was through the command line. DOS on an IBM PC was my entry point to computing, and HIMEM.SYS was the configuration that stood between me and the latest PC games. It was a heady time, and we knew no differently.

I’m also old enough to remember the novelty of a PC with Windows pre-installed. “What is this sorcery?” I pondered, walking through the little indie computer shop. “If I want Windows, I’ll install it myself!” Thus began the drift away, on the PC platform, from ye olde DOS prompt. Unfortunately, it seems that the drag-and-drop nature of Windows carried beyond the end-user PC market and into the Windows Server user base. I, for my part, was dragged along that current to some degree. While I retained some basic competency with the command line, my terminal/DOS muscles certainly atrophied over time.

Meanwhile, the Linux and Mac communities quietly carried on with their work in that good ol’ terminal window. A rift began to form, between two user bases: one leaning heavily on graphical interfaces, and another one less dependent on icons and mouses. Over time, I think this became something of a hallmark of the difference between the Microsoft folks and the rest. This is, of course, a generalization. However, I think we can agree that, until the introduction of Powershell, Windows’ support for command-line tools left much to be desired when compared to Linux variants.

Until recently, that was the state of my own personal experience as a Microsoft .NET developer and Windows adept. I then decided to write a book about DevOps tools. As I developed this book, it became clear to me that I needed to provide more than just instruction. I needed to provide a platform for the learning I would ask my readers to undertake. I began to develop an idea for a free Learning Virtual Machine. Of course, my first question was, what OS?

Windows, for better or worse, simply isn’t an option as a free resource. The only option for free appliances, such as the one I had in mind, is Linux. I was faced with a challenge: must I finally go learn Linux? After some hand-wringing, I decided that yes, I must. With that came the inevitable: living on the command line. Linux is CLI-first, GUI a distant second. I dove in and… much to my surprise, I rediscovered my long-lost love for working in the command line.


All this reflection begs the question: is there something inherently better about the command line? Are the GUI detractors just haters, looking for something to dislike about Windows, and its users? Perhaps, but I think it goes deeper than that. I do believe there is a quantitative difference between graphical interfaces and command-line interfaces.

“All abstractions leak, some are useful.”

-Unknown

Graphical interfaces, like it or not, are an abstraction. They hide things from you. Sometimes, they lie to your face.

The command shell (whichever happens to be your favorite,) by contrast, is brutally honest. If something blows up, you know it immediately.

This is the reality I rediscovered as I forced myself to go back to life at a command prompt. The current crop of DevOps technologies, including such worthies as Docker, Kubernetes, Git, Vagrant, Packer, Chef, Puppet, and many more, are all primarily command-line tools. Tools tend to be simpler, more direct, and definitely better suited to automation, when they are primarily a command-line interface (CLI.)

I was drawn back into command-land as a result of research into modern software delivery tools and techniques. The world of Information Technology is changing at a rapid pace. DevOps and Site Reliability Engineering are melding the roles of developers, administrators, and operators into a single super-role. These jobs positively live at the command prompt; there’s no way around it. The power of the command line is now, arguably, equal on all platforms (kudos must go to Microsoft for dramatic improvements in this area.) There has never been a better time to dive back in. Get your keyboards ready.


Some of us are more comfortable than others with CLI tools, for a variety of reasons. If you’re less than comfortable, but you’d like to improve your skills, allow me to offer some suggestions.

Learn Linux (you’ll want to anyway.)
There’s simply no debate- Linux has been ascendant for years, and its time has come. (I myself recently made the switch to a Mac, so I'm fully converted to a Linux variant and couldn't be happier.) It’s difficult to avoid Linux in modern software infrastructures. Linux is invading even the most dyed-in-the-wool, homogeneous Microsoft environments; and that is entirely by Microsoft’s design. Support for Linux is spreading like wildfire throughout the Microsoft product ecosystem.

Learn Docker
Docker grew up in Linux, and Linux is the place to learn Docker. Docker is 99% command-line. Starting containers, managing running containers, and certainly defining new containers is a command-line task. You’ll also learn even more about Linux internals, as the majority of containers on Docker Hub are Linux-based.

Install ConEmu
One of my personal pet peeves regarding the command-line experience on Windows is that, while it is equally capable, it is ugly compared Linux and OSX. It doesn’t have to be that way, however. ConEmu, the Windows Console Emulator, provides nearly unlimited visual and environmental customizations.

Install Windows Subsystem for Linux
You’re probably noticing a pattern here (ahem, Linux.) Yes, an entire Linux subsystem is now available for Windows 10 Anniversary Edition and later. You can install Ubuntu or SUSE Linux. It’s not just a shell- it’s an entire Linux subsystem, with all the built-in commands and utilities used by Linux developers and administrators.

Use Chocolatey
“When in Windows, do as the Linux users do.” Is that the quote? Anyway, there’s a reason why Linux uses a command-line software package system: automation. Start installing your tools from the command line like all good DevOps practitioners, and you’ll be creating bespoke developer environments in no time.

Learn Powershell
Powershell is just as capable as bash, but it uses a very different command structure. It is the method of choice for automating things in Windows. Learn Powershell, and you’ll be a valuable asset in any IT setting.

Would you like to learn about some great command-line DevOps tools?
http://www.devopskatas.com

Top comments (6)

Collapse
 
kspeakman profile image
Kasey Speakman

“All abstractions leak, some are useful.”

I believe this is a repurposed version of this quote:

All models are wrong but some are useful

  • George Box, ref
Collapse
 
deafmetal profile image
Deafmetal

Meanwhile, the Linux and Mac communities quietly carried on with their work in that good ol’ terminal window.

Only in this century! Before OS X the command line was not so common in the general Mac community.

Collapse
 
sqlrob profile image
Robert Myers

A warning on conemu and other terminal emulators for Windows. They DO NOT behave the same as a pure command(or powershell) prompt

A coworker wrote a CAKE script for the build that was supposed to wait for a spawned process to finish. The script he wrote would simply block forever on my machine. Finally tracked it down to some of the kludges he wrote to find the right process to wait on. The entire set of kludges was needed because he was using a terminal emulator and the spawned process was not a direct child process.

Collapse
 
francescobianco profile image
Francesco Bianco

Please look up Vintage Package Manager
github.com/francescobianco/vintage

Collapse
 
mdabek profile image
Marek Dabek

You got my full attention at "HIMEM.SYS was the configuration that stood between me and the latest PC games" ;) Hours of tinkering to load that damn Strike Commander!

Collapse
 
sqlrob profile image
Robert Myers

Yeah, mention of himem.sys gave me some serious flashbacks.

It was also my first bout of reverse engineering. I ended up writing a full screen, boot time, fully interactive config.sys editor for DOS 5 to make things simpler to swap around.