Just as economists sometimes use the term "widget" as the ultimate substitute for "something" that is being measured, programmers tend to use the term "foo" (pronounced FOO) as a universal substitute for something real when discussing ideas or presenting examples. Suppose you are defining a template for any group of programmers to follow when creating a new user command, you might specify that the syntax for the command should be in the form:
Command foo (arg1, arg2)where the "foo" would mean "the name you give to this command." In other words, "foo" is a nonsense kind of placeholder for some value that will be provided when using this template to define a real command. (And the "arg1" and "arg2" are arguments or information you would define that would be passed along with the command.) Because "foo" has no rational meaning of its own and because "foo" is conventionally used as such a placeholder, the idea will be clear to any programmer.
Foo or any such word used this way is formally known as a metasyntactic variable. Eric Raymond, probably the world's greatest authority on foo and other metasyntactic variables, also lists qux, waldo, fred, xyzzy, and thud among others that are occasionally used. Although foo is the canonical metasyntactic variable, Raymond notes that cultures outside the United States have their own preferences. Fred, barney, and wombat seem common in the U.K. Toto, tata, titi, and tutu reportedly are used by the French. Blarg and wibble are used in New Zealand.
The origin of foo seems wrapped in the mists of time, but Raymond observes (and we remember) that in Bill Holman's comic strip of the 1930-50 era, Smokey Stover, the letters "FOO" commonly appeared, unexplained and as a kind of running gag, on license plates, in picture frames, and on the backs of sandwich board signs.
Also see FUBAR.