The ADM-3A leaving it’s mark

Did you ever ask yourself, why on *NIX-Systems your home directory has the shortcut tilde (~)? Or why on the text editor vim the cursor could not only be moved by the arrow keys but also via H, J, K and L? Why not W, A, S and D, which today is famous as it is used by many games? Well I often did ask myself, but never actually tried to find out why. I had my explanation for H, J, K, L, as they lie on the home row of the keyboard, thus allowing fast movement.

One might think that H, J, K and L an idiosyncrasy of vi/vim, but when you look carefully you find other software that use the same keys for moving: Rouge, Hack and NetHack – the predecessors of Diablo use HJKL. Also the C Shell (csh) and it’s improved and today still popular version TENEX C-Shell (tcsh) can be controlled by H, J, K and L. The most recent tools are the web interfaces from Gmail and Google Labs – as well as the browser Pentadactyl. Of course, for the later tools it’s more convenience than a historical cause. But regarding vim, by accident I just now found out why these keys are used – and why the tilde is the shortcut for the home directory on *NIX systems.

ADM-3A Keyboard layout; by StuartBrady under CC BY-SA 3.0

ADM-3A Keyboard layout; by StuartBrady under CC BY-SA 3.0

The reason is this keyboard layout. As you can see, H, J, K and L have arrow keys. They where accessible with the Ctrl-Key and the layout belongs to the ADM-3A, one of the first ASCII computer terminals (also referred to as teletype), i.e. an end users device to connect to a computer (which at that time used to be mainframes). Before teletypes were used, the computer could only communicate with a teleprinter – data input was provided by a teletypewriter. So, now we have one of the very first ASCII terminals, and on this machine H, J, K and L have arrow keys. These terminals where also used by the University of California, Berkeley on their BSD-Systems, and one of it’s students was William Nelson ‘Bill’ Joy. And he is the one who wrote vi, to replace the since then famous editor ed, which was a line editor (perfect for teletypewriters/-printers, but unfortunate for teletypes).

As the first teletypes didn’t even have any arrow keys, it just seemed natural to use the systems arrow keys. And as vi has different modes, most of them not for typing, it was convenient, to get rid of Ctrl on those modes. The keyboard layout also explains why ESC is used to switch modes. On modern keyboard layouts it’s one of the most unreachable keys from the home row. But on the ADM-3A it was by far more reachable.

ADM-3A; by StuartBrady under CC BY-SA 3.0

ADM-3A; by StuartBrady under CC BY-SA 3.0

And did you realize the “Home” Button on the upper right? Besides “Home” it also holds the symbols caret (^) and tilde – yes the tilde. It was again Bill Joy who was unhappy with the original unix shell by UNIX and C inventor Kenneth ‘Ken’ Lane Thompson. Also the replacement by Stephen ‘Steven’ Richard Bourne (the Bourne shell (sh)) – the first scriptable shell – didn’t appeal to Bill. But after having seeing sh’ scriptability he decided to write his own shell, the C Shell. The main idea of the csh was to make the scripts more C like, but Bill included some modern features that where incorporated in later shells, such as the history, job control and aliases – and included the alias for the home directory. And of course again inspired by the keyboard in front of him – the one of the ADM-3A – he chose the tilde as shortcut for the home directory, as it’s key was labeled with “Home”. So what today seems to be totally randomly without any thought at all made totally sense back in the days.

Of course with the speed of development of that time and no standards layouts switched from year to year and from device to device – since it finally became what today sits in front of our monitor. And though a lot changed, some relicts still remain from back those years, when you used a teletype to connect to a mainframe. Btw. the ADM-3A was a 12 inch screen display, that could display 80 characters in a line, which was the standard at that time – there you have the 80 character limitation that even today is recommended for mails and source code. And did you know that teletype is abbreviated tty? Even today on *NIX Systems you have /dev/ttyn device files for the terminal (and formally also for Keyboard, Mice and Monitors, if they were’nt connected over a serial port, that used /dev/ttysn) and /dev/ptyn devices for pseudo teletypes, e.g. remote logins via the Secure Shell (ssh), etc. and since terminal multiplexing multiplexed terminals are called pseudo teletype slaves (pts).

pygospa@marcho ~ % ps
126 ttyAMA0  /sbin/agetty --noclear ttyAMA0 38400 linux
127 tty1     /sbin/agetty --noclear tty1 38400 linux
15998 pts/1  -zsh
16076 pts/1  irssi
25084 pts/0  -zsh
25134 pts/0  tmux a
pygospa@lalaith ~ % ps
2414 ttys003 ssh marcho

But those facts are generally widely known than the origin of tilde and the HJKL navigation 😉


Please comment. I really enjoy your thoughts!

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s