What is the "yes" command?

Solution 1:

A long time ago (SySV days and earlier), the fsck command did not have -y or -n options. The command would interactively ask you to change hundreds or thousands of items, expecting a 'y' or 'n'. The yes command was created to pipe to fsck, and some other programs to be able to repeated answer the interactive questions (again, this was SysV days, long before Tcl and Expect). The yes program fit very well with the UNIX philosophy: small programs that do specific things very well and work with other programs.

Solution 2:

From wikipedia:

By itself, the yes command outputs 'y' or whatever is specified as an argument, followed by a newline repeatedly until stopped by the user or otherwise killed; when piped into a command, it will continue until the pipe breaks (i.e., the program completes its execution).

It can also be used to test how well a system handles high loads, as using yes results in 100% processor usage, for systems with a single processor (for a multiprocessor system, a process must be run for each processor). This, for example, can be useful for investigating whether a system's cooling system will be effective when the processor is running at 100%.