1. interj. Term of disgust.
2. Used very generally as a sample name for absolutely anything, esp. programs and files (esp. scratch files).
3. First on the standard list of metasyntactic variables used in syntax examples.
foo is the canonical example of a 'metasyntactic variable' -- a name used in examples and understood to stand for whatever thing is under discussion, or any random member of a class of things under discussion. To avoid confusion, hackers never use 'foo' or other words like it as permanent names for anything. In filenames, a common convention is that any filename beginning 'foo' is a scratch file that may be deleted at any time.
The etymology of hackish 'foo' is obscure. When used in connection with 'bar' it is generally traced to the WWII-era Army slang acronym FUBAR ('Fucked Up Beyond All Recognition'), later bowdlerized to foobar.
See also FUBAR.
However, the use of the word 'foo' itself has more complicated antecedents, including a long history in comic strips and cartoons. The old "Smokey Stover" comic strips by Bill Holman often included the word 'FOO', in particular on license plates of cars; allegedly, 'FOO' and 'BAR' also occurred in Walt Kelly's Pogo strips. In the 1938 cartoon Daffy Doc, a very early version of Daffy Duck holds up a sign saying "SILENCE IS FOO!"; oddly, this seems to refer to some approving or positive affirmative use of foo. It is even possible that hacker usage actually springs from 'FOO, Lampoons and Parody', the title of a comic book first issued in September 1958; the byline read 'C. Crumb' but this may well have been a sort-of pseudonym for noted weird-comix artist Robert Crumb. The title FOO was featured in large letters on the front cover.
An old-time member reports that in the 1959 'Dictionary of the TMRC Language', compiled at TMRC there was an entry that went something like this:
FOO: The first syllable of the sacred chant phrase "FOO MANE PADME HUM." Our first obligation is to keep the foo counters turning.
For more about the legendary foo counters, see TMRC. Almost the entire AI staff was involved with TMRC, so it is not clear which group introduced the other to the word FOO.
Very probably, hackish 'foo' had no single origin and derives through all these channels from Yiddish 'feh' and/or English 'fooey'.