Falling in like (even love?) with the shell

Welcome, readers, to my first non-introductory post in this space. This past week, my path toward becoming a bona fide developer hit a fairly serious snag.

The problem? I had never become even remotely comfortable operating in shell environments. I was never forced to operate in these environments because I was (un?)fortunate enough to come of age after the point-and-click-GUI revolution of the 1980s. It also doesn’t help that the white-text-on-black-background aesthetic of command line interfaces (CLIs) always made them seem like a kind of curious relic from a primitive, benighted, and thoroughly superseded era of computing.

But it turns out that I was incredibly misguided in my neglect of the shell environment for two reasons. First, because familiarity with shell environments is absolutely indispensable in carrying out a wide range of tasks as a developer. In just my first week as a would-be developer, I was forced to work in the shell in doing all of the following: interacting directly with MySQL databases, working with the SASS-to-CSS converter (a very nifty tool), using my first package manager (the highly recommended Homebrew), and also installing and working with Ruby on Rails (as well as toying with Django, though making little progress with it).

The documentation for all of the above, even when aimed at “beginners,” simply assumed that I would know what to do when given a piece of text saying “sudo something-something” or “gem install such-and-such.” I must admit with no small amount of sheepishness that I at first had no idea where I was even supposed to do this. In my browser? In my Windows command prompt? In DOS, of all places? What on Earth is this dollar sign that keeps popping up? And what is bash, beyond an English verb that is weirdly satisfying to say?

This became perhaps the very first pet peeve that I developed while learning web development. Even the most basic tutorials (well, okay, a little more advanced than the oppressively omnipresent “Hello world” tutorials that glut the web to the brim) never actually explained what this CLI business is. I learned very quickly that I needed to have at the very least a rudimentary understanding of the shadowy world of the CLI, in spite of there being little that was less comfortable to me. Even after days of concentrated effort, the blinking cursor against a dark background occasionally made my mouse start looking something like this.**

Fortunately, it turns out that functioning in the shell environment need not be so intimidating at all. It just requires proper introduction and a small bit of devotion. Within a few hours thumbing through a few books and websites, I managed to acquire enough of an understanding of the shell to feel a bit less overwhelmed and perhaps even slightly comfortable in this environment.

I started by cheating and asking some colleagues for pointers. They recommended to me Cameron Newham and Bill Rosenblatt’s Learning the bash Shell (book and PDF), which I found to be highly readable and instantly helpful. After just a few pages, I found myself able to perform some of the basic tasks that we associated with CLIs, like creating and removing directories, wildcards, “touching” files, and piping commands together, like this line that I ran in bash, which enabled me to put the current date and time into a new file called “now” and then place that same information in a separate file called “then:”

$ date < now $$ cat < now > then

Sad as it may sound to more experienced programmers, this constituted a legitimate “a-ha!” moment for me. It made me feel like I could finally begin to play God on my own machine, like I had torn back the veil that had kept me from genuinely interacting with my system. In a future post, I’d even like to tackle writing some of my very own shell scripts. For now, I’d like to offer a bit of advice.

For those of you to whom this post was entirely opaque, I absolutely implore you: sit down and spend a few hours experimenting with shell environments. You will absolutely not regret it, as it will drastically ease your entry into whole worlds of programming and development (particularly if you end up using things like GitHub or cloud platforms like PHPFog and AppFog, which rely heavily on CLIs). I would even advise more advanced programmers and developers to brush up on their knowledge and to check out some of the many shell interfaces available out there, like Zsh, iTerm, and iTerm2 for Mac users, and GNUStep for Windows. Ultimately, it might not be the best use of your time to become an absolute ninja in the shell. But an overall programming ninja afraid of the blinking cursor strikes me as a contradiction in terms.

**I have since overcome this.

Share this post
Facebook Twitter Google
Try AppFog: The new PaaS Hackers love
  • http://twitter.com/Dr3Daemon Dr3Daemon

    If you want to take some advice from an old hand then I offer you this. Set up ipython and start it in the “shell” configuration (the exact way you do this will vary depending on the version of ipython you have but is somthing like “ipython –profile pysh”). Then (if you haven’t already) learn python. 

    You don’t really want to have to go through the pain of learning all the arcane bash syntax for variables and loops etc. if you can avoid it. And with a few python modules such as glob you can still have all the power that a shell environment affords you. Finally, by simply putting an “!” at the start of a line you can fall back to using bash or whatever underlying shell environment you have if you really need to.

    Interacting with the CLI using a real programming language is one of the most powerful and satisfying things ever. You will soon be effortlessly blending command line interactions with scripts to perform routine tasks with “real” code, effortlessly moving your source from one environment to the other as the need arises.

    Note – I am a python person, so I am suggesting the python way, I’m sure there may be a ruby equivalent or other options for other languages out there…

  • Luc Perkins


    Believe me, there is little that is more welcome to me right now than advice from “old hands.” I really appreciate your message and am excited that you’re reading.

    I’ll talk about this later in the week, but I’ve chosen Ruby as a language to start with. As for a platform, Rails and Sinatra both seem to have strong points in their favor. I’ve interacted a bit with Ruby in CLI environments (just the normal IRB and the Rails console), but haven’t done a whole lot of exploring there yet. I’m going to take your advice and do just that in the Ruby-sphere.

    I learned a little bit of Python a few weeks back and absolutely loved it. The syntax is just a dream, the libraries are phenomenal, and the Python community in Portland is strong. I can see myself diving into it down the road. I might just need some advice from someone like you when the time comes! I’ll let you know.

    As for what you said about CLI, I think I’m already beginning to get a strong taste of exactly what you’re talking about. The more comfortable I get in that environment, the more I feel like I’m crossing a threshold. Learning how to do that within a programming language seems like the next logical step in that development. Any advice on how to begin that process, beyond the already very good advice you provided?

    Many thanks and best wishes from Portland,

  • http://twitter.com/Dr3Daemon Dr3Daemon


    just seen your comment and read your later post.

    The reasons you give for choosing Ruby are the best reasons – if you happen to have good help on hand for Ruby go for it! Better to learn Ruby right than to learn any other language wrong.

    Good luck with the Ruby stuff, I don’t know if there is a Ruby-based iPython-like system that has autocomplete and other shell stuff built in. Maybe that is a project that needs starting…

    • Anonymous

      I did a little bit of asking around and found this:


      This is supposed to be something akin to iPython, but honestly it seems rather inferior based on what I’ve seen thus far. You are indeed right that that sounds like a very worthwhile project for Rubyists to undertake if it isn’t underway already. Score another point for the Python community!

      • banister

        interesting, what was inferior about it? Just curious.

Powered by Olark