Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The UNIX prompt uses a $ symbol to indicate that your input is expected.

I was wondering why this symbol was chosen -- if there is a reason. Dollar just seems a little unexpected. A > would have been more suggestive in my opinion.

share|improve this question

migrated from stackoverflow.com Oct 19 '09 at 23:16

This question came from our site for professional and enthusiast programmers.

3  
Though not programming-related, certainly computer-related, thus better at Super User, I think. –  Joey Oct 19 '09 at 23:13
    
I want to know the answer, too. I'll look for it on SU. –  Gabriel Hurley Oct 19 '09 at 23:14
13  
It's the Bourne shell prompt, not the Unix prompt. The default csh prompt is %. –  wfaulk Oct 20 '09 at 1:58
1  
wfaulk, I wish I could upvote your comment more than once. –  Richard Marquez Oct 20 '09 at 2:07
8  
€ didn't exist yet... –  mouviciel Oct 20 '09 at 8:30

4 Answers 4

up vote 26 down vote accepted

Let's explore a little:

  • Version 8 Unix is easy. There's still man pages available. Get to the sh man page and search for prompt. You'll get to a point where you read:

PS1 Primary prompt string, by default ``$ ''.

PS2 Secondary prompt string, by default ``> ''.

  • So let's see if that was the first. Version 7 Unix was harder to track. Thankfully Bell Labs still holds the manual (there were no man pages in 7. Version 8 introduced them). Again search the page for prompt and you will come to this:

When you have finally gone through this entire process without provoking any diagnostics, the resulting program can be run by giving its name to the Shell in response to the `$' prompt.

  • What about version 6? Version 6 Unix wasn't hard to track. But hard to find the relevant information. The documentation is available here. I finally found it under beg/u1. At some point you read:

The culmination of your login efforts is a percent sign ``%''. The percent sign means that .UC UNIX is ready to accept commands from the terminal.

Aha! So version 6 didn't have it. Version 7 was the first! Released in 1979.

Happy? Hate to rain on your parade, but don't be :)

Problem is that version 6 was one inspiring Unix. Look at the variants here. Can it be that the $ sign has a command prompt was not started in Version 7, but instead in one of these variants and then the idea incorporated into 7?

At this point I got tired of hunting for operating systems documentation from a time when I was 6. This at least narrows it down considerably. We know Version 7 was the first bell Labs release to show the $ sign as a command prompt. All we need to be sure is that none of those Version 6 variants introduced it.

One last thought though:
While the idea of $ being a hint to the word shell or script is appealing and makes all sense, don't expect this to ever be officially confirmed. Unix development was shared by a rather large group of people with much bigger concerns in life then keeping track of how a symbol evolved. And some of these extraordinary programmers are not even among us anymore.

Most probably, the best you can hope to get from the question "What is the origin of the UNIX $ (dollar) prompt?" is the name of the first unix shell introducing it.

share|improve this answer
4  
Version 7 was the first Unix with the Bourne shell. It replaced the Thompson shell in Version 6. So this being a delineation between shell prompts makes sense. –  wfaulk Oct 20 '09 at 1:59
    
Also, the Bourne shell was developed by Stephen Bourne. –  wfaulk Oct 20 '09 at 2:01
1  
Yup. We pretty much can trace it to the Bourne Shell. As for the author, no doubt about it. But he was an employee at Bell Labs just like everyone else. –  A Dwarf Oct 20 '09 at 2:06
1  
Also, there were man pages at least as far back as Version 3: minnie.tuhs.org/UnixTree/V3/usr/man/man1 –  wfaulk Oct 20 '09 at 2:32
1  
Back in sixth edition days and before, UNIX was distributed with full source code included. All the universities who got it tended to do local modifications (that's where BSD came from) so perhaps some local systems programmer at the University of Waterloo though that a "shell" prompt should look more like a snail, and changed the % to an @. And as you say, there were lots of variants, and when they got collated back together in v7, no doubt the origins of changes were already fuzzy. –  Michael Dillon Oct 20 '09 at 17:51

Sadly, I can't answer the question, but I can give you a few pointers.

share|improve this answer

The original Bourne shell prompt was a snail shell, "@". I remember this on UNIX 6th edition which, I believe, is before UNIX was sold commercially. So the switch to a $ sign could be related to commercialisation of UNIX, as Robert suggested, $hell.

share|improve this answer
3  
The Bourne shell didn't exist until Version 7. –  wfaulk Oct 20 '09 at 2:20
1  
Well, we just called it "the shell" so I don't really know who wrote it. I do remember seeing posters with all the shell commands documented on them, arranged in a spiral like a snail-shell or at sign. Maybe it was from O'Reilly but I can't be sure. –  Michael Dillon Oct 20 '09 at 17:47

Actually, the standard command-line prompt in Linux for a normal user account using Bourne, Bash or Korn shell is the dollar sign ($) while the root prompt is a hash mark (#). By contrast the traditional C shell prompt is a percent sign (%).

If I were to guess, the $ is reminiscent of the word $hell, which is probably why it was chosen.

share|improve this answer
2  
He's asking for the actual origin, not for what people guess it might be. –  davr Oct 20 '09 at 0:08
2  
Don't get snarky. Judging from the other answers posted here, it appears that nobody really knows for sure anyway. –  Robert Harvey Oct 20 '09 at 21:13
    
I guess the root prompt # is so chosen to coincide with the comment character, reducing the chances of accidentally pasting dangerous commands... or maybe not! I don't think they had much in the way of cut-and-paste back in the day. –  Sam Watkins Mar 12 '13 at 1:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.