How do you do
This greeting was once commonplace, especially amongst the English upper classes, but is now heard less often and is largely restricted to quite formal occasions. The phrase became one of the touchstones in the separation of the U from the non-U, that is, the separation of the upper classes from the rest. The U contingent had napkins, lavatories and greeted people with 'how do you do'; the non-U had serviettes, toilets and greeted with 'hello'. The proper response to 'How do you do?' was a reciprocal 'How do you do?', as in this exchange from Oscar Wilde's Lady Windermere's Fan, 1892:
Lord Darlington: How do you do, Lady Windermere?
Lady Windermere: How do you do, Lord Darlington?
'How do you do' has its essence in the early meaning of the verb 'do', which has been used since the 14th century to mean 'prosper; thrive'. Even now, gardeners sometimes refer to a plant that grows well as 'a good doer'. The association with 'do' as specifically relating to one's health is first found in print in The Paston Letters, 1463:
I wold ye shuld send me word howghe ye doo.
The Paston Letters are, incidentally, an invaluable source when tracing the origin of English phrases and include the first reference to several commonplace idioms; for example, make no bones about, fool's paradise and hugger-mugger.
John Foxe, in his account of the persecutions of Protestants, The Book of Martyrs, 1563-87, recorded the first-known citation of a version of 'how do you do?' as an inquiry after someone's health:
God be thanked for you, How do you?
'How do you' is clearly the exact 16th century equivalent of our present day 'how are you?'. It was specifically asking after someone's health and a reply in kind would have been expected.
There are numerous records of variants of 'how do you', dating from the 16th century to the 18th century. These spell the term as how-do-ye, howedye, howdie, how de, etc. The change in usage from a query about health to a greeting was gradual. It was some time later, not until the 18th century in fact, that 'how do you do' began to be widely used as a general greeting. Samuel Richardson's novel Pamela Or Virtue Rewarded, 1740 is an early example of that:
O my good old Acquaintances, said I, I joy to see you ? How do you do Rachel? How do you all do?
The addition of the second 'do' to 'how do you' was probably the consequence of the change in accepted form of expression, rather than any alteration in meaning. As a mediaeval phrase like 'wither goest thou?' became 'where are you going?' by the 18th century, then 'how do you', by the time that it became a greeting, already had an antiquated sound and was updated to 'how do you do'.
In a parallel with 'hello, hello, hello, what's going on here then?', the stock police drama phrase that was much used in the md-20th century when a perplexing or comic scene was discovered, Victorian dramas often used 'here's a pretty how do you do'. That one appears to have been coined by the relentless inventor of language, Thomas Haliburton, in The Clockmaker, 1835:
Thinks I, here's a pretty how do you do; I'm in for it now, that's a fact.
Definitive evidence for this is lacking, but it is quite possible that the American 'howdy' derived from the the early 'how d'ye' form, rather than, as is usually assumed, a shortening of 'how do you do'. As with 'wotcher' and its variants, the Americans, with their fondness for playfulness in the language of greetings, have extended the plain 'howdy' to 'howdie doodie', 'how's tricks', 'howdy pardner' (that one primarily in cowboy films) and, more recently, 'how's it hangin'. The British, ever more traditional in these matters, have gone back almost to the original mediaeval 'how do you?' with the Northern 'how do'.