Wednesday, March 9, 2011

Stop hating on the command line

Let's begin with this simple assertion: sucks. It has always sucked, and always will. Powershell might be nicer, but most people haven't learned how to use it, and it's only available in one operating system anyway.

If I say "command line" to a Windows-only person, they're thinking "" Avoiding that command line is a huge part of making their lives pleasant. I am not slamming on hating the windows command line. All of us Unix/Linux geeks hate it too. I never feel much less productive than when I'm in I avoid it too.

I started back when CP/M was the killer operating system. Its command line was not so great either, but it had a strong free software community who shipped programs to each other on floppy disks. As a result, we had this language called "submit" (and later "supersub") which you could actually do stuff in. It was like a real language. The command line suddenly was pretty decent.

When the PC came out, it pretty much got rid of the CP/M market, and with it the community. DOS had batch files and, and those were okay. You really had to use those tools, because there was not much else. Eventually GEM and DESQview came along, and multitasked your DOS text apps nicely. They were taking hold when Windows first came out and destroyed the market and community for those programs. But that's neither here nor there.

What happened in the 80s that turned me into a command-line fan was my defecting to Unix and learning to use a proper command line. Bash and Zsh are the popular, ubiquitous shells these days but in the days when I jumped in the world was divided into csh and ksh users. All of these shells are command-line interfaces to the whole freaking operating system, and the Unix designers (then and now) worked to make everything available to the shell. Instead of a crummy one-line window to slow-key commands into, these were full programming languages with proper variables, decent flow control, error reporting and handling, wildcarding, extensibility, event-handling, online help, and access to system innards. It went far beyond meager batch files.

It just got better with each generation of shell. You an launch subshells, and stack shells so that you can "pop" back to an earlier context. Each subshell has its own current directory, and any one shell can have a stack of directories (pushd/popd/rotd), each shell has history and history search. There is process control and the ability to pull processes into background and foreground. There are rich stream-oriented languages and tools for processing data. There is more functionality in the command line than you can take in at a glance.

The manual page for bash (arguably the most ubiquitous shell) is over 3000 lines long. I know because I did "man bash | wc -l" to find out. Considering that the documentation is terse, that represents a heck of a lot of functionality. Zsh is so feature-rich its manual has been broken into 17 chapters.

Of course, these are available via cygwin for you windows machines (if you really have to use windows) but will be slow because windows file systems are slow, and are a little crippled because windows has a different design philosophy than the Unixen do.

But the point is that "avoid the command line," however reasonable when the command line is, is hardly a universal goal. Instead, mac and linux and unix people almost universally embrace the command line, often preferring it to gui tools to do the same jobs. It is explorable, scriptable, powerful, and useful.

So stop hating on 'the command line.' Next time, windows users, say "I hate my command line." Install cygwin (or better, Ubuntu) and give the manuals a little light read. You will be surprised what power lies just under the GUI.

For the record, GUI is kinda cool, too.

1 comment:

  1. Could it also be a generational issue? I've been using the command line for almost 30 years so a good portion of that we only had the command line so we had to be effective at it. I just find it so much more productive. I think that's also why I run viemu inside Visual Studio or Vim on *nix