Subscribe: by Email | in Reader

Telnet Song -- Guy L Steele, Jr

(Poem #1419) Telnet Song
 There is a program called TELNET to get to another CPU.
 Control up-arrow is the escape; it's doubled to send it through,
 and "quit" is control up-arrow Q.

 A hacker once used TELNET to get to another CPU.
 He knew he could quit whenever he wanted to: all he had to do was type
 control up-arrow Q.

 Instead the hacker used TEL-NET to get to another CPU.
 He knew he could quit whenever he wanted to: all he had to do was type
 control up-arrow [at i-th time, repeat 2^i times]
 [repeat verse n times; the choice of n is free]

 The hacker soon got bored with this, and wanted to get back.
 He sighed, and started the exponential popping of the stack:

 The hacked flushed the TEL-NET to the most distant CPU:
 He couldn't log out until he had killed them all,
 counting up powers of two: he typed
 control up-arrow [at i-th time, repeat 2^(n-i+1) times]
 Q. [repeat n times]


 The hacker's eyes were bloodshot; his fingers, black and blue;
 He wanted to log out and and go home to bed, and sleep for a day or two.
 He typed L O G O U T ... carriage return ...

 The hacker was on a network with only twenty CPU's.
 But if he had telnetted to them all,
 he would not yet be through with typing
 control up-arrow [repeat 7 times]
-- Guy L Steele, Jr
Note: This was written after an article by Donald E. Knuth, titled "The
Complexity of Songs":
    D.E. Knuth, 'The Complexity of Songs', Communications of the ACM 27 (4)
    pp. 345--348, April, 1984 (repetitions indicated; the song is only sung
    correctly if the appropriate number of repetitions is used)
    Some comments: Strictly speaking, the song is not part of the article;
    it was appended afterwards. The composer and lyricist is Guy L. Steele,
    Jr. The melody has a certain haunting quality that is quite hard to
    convey in ASCII text. I don't know whether it has ever been played. The
    composer has email, so it shouldn't be too hard to find out.

  (Sitaram points out that that last bit is a dig at Knuth's refusal to use
  email. :))

  2^i is 2*2..*2 [i times], e.g. 2^5 = 2*2*2*2*2 = 32

  I've explained the maths behind the song in a postscript (it gets long)

Two of the more delightful aspects of hacker culture [see links] are an
abundant and enthusiastic creativity, and a strong sense of play.
Unsurprisingly, these have combined to produce a large body of verse,
ranging from esoteric in-jokes to catchy and accessible song parodies, and
even some genuine "poetry". There is a marked, qualitative difference from
poems like yesterday's, though - this is not a case of poets embracing the
brave new world, but rather the denizens of that world embracing verse, a
look from the inside rather than from the outside. (There is a significant
overlap with science fiction fandom's filk music, not least because so many
fans are hackers and vice versa, but the two are nonetheless different

Today's song is definitely one of the classics of the genre, and not just
for its distinguished (if you'll forgive the understatement) authors -
Kunth's notion of song complexity has an irresistible combination of
quirkiness and serious academic value, and Steele's song highlights the
fun factor while providing a good intuitive grasp of Knuth's point. And
while the verse itself isn't as clever as some of the others out there, it
has a nicely hypnotic rhythm that fits the "trapped in an exponential loop"
nature of the song.



"Hacker" is used throughout in the original sense of the word - see

[broken link] for some idea of
what is meant by "the complexity of songs".

[broken link] lists
chords for the song

Biography of Steele:
  [broken link]
and of Knuth:

The Jargon Files:

And a great collection of computer-related songs:


A little digression into mathematics:

  There is a program called TELNET to get to another CPU.
  Control up-arrow is the escape; it's doubled to send it through,

An 'escape' is a character that sends the *next* character not to the
current session but to the one below it in the stack. So, say our intrepid
hacker logged in to machine A, telnetted to B, and from B telnetted to C

His stack now looks like this: [hacker -> C -> B -> A]. Anything he types
gets executed by machine C. Now supposing he wants to send a keystroke to
machine B instead? What he needs to do is to escape the keystroke. Escape,
here, is control-up arrow, so to type 'HELLO' on machine B, he needs to
control-uparrow H control-uparrow E control-uparrow L control-uparrow
L control-uparrow O

or, using ^| as a shorthand for the control-up arrow key sequence,

^| H ^| E ^| L ^| L ^| O

for a total of 15 keystrokes (or 10 if you count ctrl-up arrow as one
keystroke even though it involves two physical keys).

Now supposing he wanted to send something to machine A? If he types ^|, the
keystrokes get sent to B - what he wants to do is type ^| on machine B, so
that the next character goes to machine A. But how does he type a ^| on B?
The song tells us that:
 Control up-arrow is the escape; __it's doubled to send it through,__

so we type ^|^| to send a ^| to machine B. So to send, say, an "X" to
machine A, we need to type ^|^|X, right? Nope - because the ^|^| sends a ^|
to machine B, and then the X goes to *machine C*, the machine at the top of
the stack. To send the X to machine A, we need to send a ^|X to machine B.
And to do that, we need to send a ^|^| to C (which sends a ^| to B), and
then a ^|X to C (which sends an X to B), at which point we'll have sent a
^|X to B, which duly sends the X to A.

By this point, it should be clear how fast the number of keystrokes can blow
up as we add even one more machine to the stack. So let's go ahead and
complete the demonstration by logging out of A.

        Press  C   B   A
          ^|  ^|               C has a ^|, will pass the next key to B
          ^|      ^|           B has a ^|, will pass its next key to A
          ^|  ^|  ^|           C has a ^|, will pass the next key to B
          ^|Q         ^|Q      the ^|Q gets passed to C which passes it to B
                               which passes it to A which logs out

Two telnet sessions (A->B and B->A), and a total of 4 (2^2) control-up arrows
before the Q, as Steele said. Logging out of four machines is left as an
exercise :)

(Note that I assume control-uparrow-Q is a single keystroke, rather than a
control-uparrow followed by a Q, otherwise the song doesn't work)


24 comments: ( or Leave a comment )

Frank O'Shea said...

What are you doing? One of the reasons I like poetry is that it gets me
away from the mindlessness of the computer.

Seriously, this is the kind of thing that gives poetry a bad name.

Shame on you.


Ian Baillieu said...

Boring ... boring ... boring ... !
This is not poetry. Nor is it mathematics. And I wonder
how many computer literati really find it amusing or clever.
I mean, why couldn't this gormless hacker solve his 'escape'
problem simply by shutting down his PC?
If this is one of the classics of hacker verse genre, please
spare us the rest of it.

John.Cowan said...

Control-uparrow Q is indeed a control-uparrow (Ctrl+Shift+6 on the
keyboard) followed by a Q. The idea is that the remotest system
at any one time has to receive a control-uparrow (which is done
by sending 2^i control-uparrows to the home system) followed by a
Q in order to disconnect from it.

As for "shutting down his PC", this song way predates PCs. In
those days hackers had dumb terminals hard-wired to a local timeshared
system. You could turn them off, but if you turned them on again,
you'd be right back where you were before.

And yes, I think it's amusing and clever.

Anonymous said...

Hey Guy!

Q wonnnerfull wonnerfull wonnerfull wonnerfull wonnerfull wonnerfull wonnerfull Q

A.M.T.K. Class of '73
Say hello to Louis Cohen for me.

Ideas de negocios said...

Thanks for taking the time to discuss this, but I am firmly convinced of this and love to learn more about the subject. If possible, acquire knowledge, would you update your blog with more information? It is very helpful to me

Bittu Gandhi said...

Respected Sir
Guy Lewis Steele Jr.
(Great Inventor, Creative Thinker, Computer Scientist, Thinker)

SUB:-"A New Search Engine Invention Project"

Howdy Sir :)

Hello I am from India. Presently I have designed a search engine which does not exist in the whole world. I make any thing in I.T. field whenever it does not exist in the whole world. (With Some Coding In Php Language) It's not possible to make a search engine by a single person. Your valuable co-operation is needed for this. I wish to start this Search Engine project as a co-founder. This project has a very big potential.

Just for your info I have had and idea about "Cloud" long bade in 2003, but due to local circumstances in India. I could not complete that project. Co-incidentally "Google Waves" concept also had strilen in my mind already before it existed. :)

Also Sir My stories are selected in some books as a co-author. My stories are going to be considered in these 8 next books.

1) "The Purpose Driven Life" - Rick Warren
2) "Little Read Success Book" - Terrie Anderson

3) "Sedona Training Administration Book" - Ben Bridgestone
4) "50 Success Classics Book" - Butler Bowdon
5) "Energy Psychology" Dr. Fred Gallo
6) "Life Balance" Jeff Davidson's
7) " The Eldon Taylor Book "
8) "Life Just Not That Complicated Book" Jim Dineen

Awaiting reply

Have a great day

Yours Faithfully
Bittu Gandhi
(Researcher, Web Developer, Author, International Record Holder)
______________________________ ______________________________ ____________

Anonymous said...


Anonymous said...

We can help you to overcome them. The higher rates of interest.
Debt consolidation can help you often with a mouse button click
eliminate your debts, you must apply for a secured debt consolidation loan, used right, can help you with
your cash issues. Sometimes all you need to check if
there are debts and debt solutions must be found and
found as soon as possible and incur less interest.

my page - like it - ,

zarena cantik said...

perfect perfect fried rice, good post for the beginners as well..Super Prema, loved the presentation very much
Selaput Dara Buatan
Vimax asli Canada
Obat Perangsang
viagra usa
Bio Slim Herbal
Boneka Full Body
vimax canada

blogku said...

Pengobatan Kanker Ampuh ABC 132 , Pengobatan Penyakit Kanker Stadium 1 ABCA 263
Pengobatan Kanker Ampuh Herbal ABC 133 , Tips Pengobatan Penyakit Kanker Stadium 1 ABCA 264
Pengobatan Kanker Ampuh Alami ABC 134 , Pengobatan Herbal Penyakit Kanker Stadium 1 ABCA 265
Pengobatan Kanker Yang Ampuh ABC 135 , Pengobatan Alami Penyakit Kanker Stadium 1 ABCA 266
Pengobatan Kanker Herbal Ampuh ABC 136 , Pengobatan Alternatif Penyakit Kanker Stadium 1 ABCA 267
Pengobatan Kanker Manjur ABC 137 , Jual Obat Kanker Usus Besar ABCA 268

Customfurniture said...

Looking for quality custom furniture kuala lumpur?customfurniture Excellence provides your home elegant and durable furniture with comforts and delightful accents.

Encynk Builders said...

Houston General Contractor License
Looking for a reliable and licensed Houston general contractor? Look no further! We offer all of the services you need for your license at EN'CYNK Builders.
General Contractor in Houston

Superior Roofing said...

Elevate Your Home with Superior Roofing: The Go-To Roofers in Wichita, KS When it comes to guaranteeing the safety and durability of your home, one vital aspect that typically goes neglected is the condition of your roof. Your roof plays an important role in securing your family and belonging Roofers in Wichita KS

superiorhomesks said...

Looking for experienced, reliable, and skilled builders in Wichita? Look no further than Superior Homes!

As trusted builders in Wichita, we pride ourselves on creating homes of outstanding quality with impeccable workmanship. Our dedicated team is eager to put its vast skills and knowledge to work for you, ensuring your home is built to the highest standard with superior materials.

Post a Comment