What is the "yes" command?

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.


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%.


Based on the information provided here: http://linux.about.com/library/cmd/blcmdl1_yes.htm

Linux / Unix Command: yes

Command Library

NAME

yes - output a string repeatedly until killed

SYNOPSIS

yes [STRING]... yes OPTION

DESCRIPTION

Repeatedly output a line with all specified STRING(s), or `y'.

--help display this help and exit --version output version information and exit
SEE ALSO

The full documentation for yes is maintained as a Texinfo manual. If the info and yes programs are properly installed at your site, the command

info yes

should give you access to the complete manual.

In my humble opinion, the usage of a "yes" command sounds logic when you have to repeatedly authorize something in a process/script by pressing the "y" key. Which can be controlled by cancelling the program execution.

Anyway, somebody else may have experience using this command.

Tags:

Command Line