
To understand the command line...  - jonathansizz
http://geekblog.oneandoneis2.org/index.php/2012/09/30/to-understand-the-command-line
======
smacktoward
I liked this piece overall, but there's one part that annoyed me.

 _Something else that had long-lasting influence over software we still use
today was the ADM-3A terminal. If you ever wondered why vi uses 'hjkl' as
left,down,up,right - this is why._

You won't find anyone who believes more strongly than I do in the importance
of understanding our history. But _understanding_ history is different than
making a _fetish_ of it, and this explanation tiptoes pretty close to the
latter. OK, vi uses hjkl because the ADM-3A terminal didn't have arrow keys.
But every keyboard for decades now _has_ had arrow keys. Given that, what's
the value in pretending they do not?

This explanation basically boils down to "we do it that way because we've
always done it that way," which is poor argumentation.

 _It's also a good illustration of the distinction between 'easy' and
'efficient' - the modern cursor key layout, with the 'up' in front of the
'down', is obvious, intuitive, and easy to master. No argument. But it's not
the most efficient layout - it's not possible to keep all four fingers on the
four navigation keys - you have to settle for three fingers and move them
around. And if you're typing and suddenly need to move, you have to move
completely away from where you're typing and switch to the cursors._

 _hjkl answers both issues - the four keys in a line make it possible to keep
one finger on each and so move about as quickly as possible, without ever
having to move from the text-entry part of the keyboard to any other. It's not
as easy, not as obvious, but it's quicker and more efficient when you're used
to it. Even on my modern keyboard, I go for hjkl far more than I reach for
cursors._

Well sure you do, because _you have trained yourself to do that._ But how many
people can say that? And what's the value in leaving everybody else out when
you design your tools?

Anytime you talk about how UNIX-like systems have evolved, there's a danger of
falling into the trap of hailing historical cruft as "misunderstood features."
But at the end of the day, it's still just historical cruft. It's there, it
won't kill anyone if it _stays_ there, but it's not something awesome either.
It's just an evolutionary dead-end; the male nipple of software design.

~~~
scott_s
I continue to use 'hjkl' to navigate in vi(m) because using the arrow keys
requires me to move my whole _arm_. This is an awkward movement that requires
time for my fingers to find the arrow keys. When using 'hjkl' to navigate, my
right hand is always on home row, ready to either navigate or start typing.
When typing in non-vi text boxes (such as this one), I do this movement, but I
don't like it.

I do have an inefficiency: I move my hand for the escape key (which I should
remap to caps lock, but I've never gotten around to it in the past decade),
but I pivot at the elbow. It's far less awkward.

~~~
weaksauce
Try:

inoremap jj <Esc>

In insert mode you just press j twice and you get out of insert mode. This is
my favorite key remap in vim.

You can put that in your .vimrc file or just try it out from the command bar.

~~~
ImprovedSilence
I started using inoremap jk <Esc>

I'm not sure why, but I found it to be more fluid for me?

~~~
weaksauce
I have both in my rc file but I end up using jj 99% of the time. jk does feel
pretty fluid though.

------
tmhedberg
Pretty much any question about why things are done a particular way in Unix
can be answered the same way: "for historical reasons".

I'm a full-time Linux user, so that's not intended as a dig against Unix, but
merely an observation. Each of the traditional Unix utilities evolved from
some earlier tool, and carries with it to this day both the quirks of its
predecessors and many artifacts of the design constraints of the time. Some
argue that this diminishes usability, and they may have a point. But I find
that it gives Unix a certain charming character that I've grown quite fond of.
I suspect this sentiment is fairly pervasive, and probably contributes
substantially to Unix's resistance to change over time. Maybe it isn't the
simplest thing to learn from scratch, but it's robust and highly dependable
once you've learned it.

------
dreamdu5t
This article assumes the reader already knows a lot about the CLI.

A much better introduction to the commandline is Neal Stephenson's "In the
Beginning was the Command Line."

Read it here: <http://www.cryptonomicon.com/beginning.html>

~~~
oneandoneis2
Well, in fairness, I _did_ write it for a Linux User Group :)

~~~
keithpeter
How did the, er, _extended_ description of the last 10 minutes of the film
adaptation of The Lord of the Rings go down?

Did you have a live terminal on the projector and demonstrate a few commands
and then show how the output of one can be piped into another?

I'm interested in the balance between demo and explanation for this kind of
audience.

------
jff
You should make it clear that while Thompson did allocate a week to the
editor, he did not write vi--although one might think so, with that quote
coming right in the middle of a block about vi.

------
pif
> This is bad, because it means that the difference between a master and a
> beginner is almost nothing.

Wonderful!

Special thanks for explaining the genesis of thos tools names.

------
ktf
_So the "show me matching lines" functionality, which ed users made massive
use of, could be summed up as "globally search for the regular expression and
print it" - or, in ed format, g/regular expression/p. Or, to shorten it a bit
more, g/re/p_

Thanks, I've always wondered where "grep" came from! (But somehow have never
gained the momentum necessary to look it up...)

~~~
Dirlewanger
Hahaha, same. This article was full of answers for me regarding Unix stuff
that I use everyday and was only half-curious of their origins but never cared
enough to look up. Articles like these are the best.

------
dsego
Nice article, for a better understating of Unix and its history I recommend
the awesome UNIX-HATERS Handbook (<http://m.simson.net/ugh.pdf>).

------
loeschg
Where's the spoiler alert? Psh. No need to watch LOTR now... :)

