Yes!

An oft neglected command (perhaps because it is little known, or perhaps because we tend not to think of the utility it provides) is the command "yes." There are no options for the command yes, but that does not mean it is any less powerful.

Yes was written by David MacKenzie, a programmer for the Free Software Foundation.

On its own, the yes command outputs "y" and a new line until it is killed, or until the command it is piped into finishes. The immediate, and most obvious utility is for all the pesky response request prompts. (Eg, Are you sure you want to quit? Y!) Such uses might include "rm * | yes", which would essentially be the same as "rm -f *".

However, (as wikipedia points out), you can also generate large files for testing purposes using a method such as "yes 1234567 | head -1000 < file".

Yes can also be used to generate a high load on your processor, and is commonly used in heat testing. Please keep in mind that yes is a single threaded application, and if you are using it for the purposes of generating load, you will need to launch an instance for each core you wish to test.

Yes is a versatile command with many uses. Hopefully you will now add this incredibly useful command to your repertoire.

Be Sociable, Share!

Leave a Reply