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.
-
http://twitter.com/Dr3Daemon Dr3Daemon
-
Luc Perkins
-
http://twitter.com/Dr3Daemon Dr3Daemon
-
Anonymous
-
banister
