yes (Unix)
yes is a Unix command that gives an affirmative answer to a command following a pipe or outputs a continuous, user-defined character string up to the Unix command kill .
description
The execution of the yes command outputs the character "y" with a line break or a character string defined by the user and given as an argument with a line break. This output repeats itself until the user terminates it (e.g. by executing the kill command).
When routing through a pipe, this loop ends until the pipe is interrupted (e.g. because the program has reached its end).
use
yes replaces the affirmative or negative ( yes n ) responses to a command and therefore bypasses the otherwise required processing by the user.
Most commands with user queries contain a "force" option ( e.g .: rm -f ) or an "assume-yes" option (e.g .: apt-get -y ) which are identical to yes- Command behaves.
For example is
rm -f *.txt
another notation for
yes | rm *.txt
The yes command in conjunction with the head command helps to create large files for test purposes. For example, executing the command generates
yes 1234567 | head -1000 > file
a file with 1000 lines, which consists of eight characters (1, 2, 3, 4, 5, 6, 7 and a line break).
The possible use of yes is the easy generation of CPU - load . In 2006, the yes command became famous for a short time in connection with checking whether a user's MacBook was affected by Intermittent Shutdown Syndrome . Executing the yes command twice in a terminal of a macOS , defined without an abort condition, maximized the processor load, which made it possible to determine whether the heat-dependent error was actually present.
Individual evidence
- ↑ Zdnet : Test for MacBook Random Shutdown Syndrome (RSS). Retrieved September 19, 2018 .
- ↑ Techpaedia: Testing your MacBook for Random Shut Downs. (No longer available online.) Archived from the original on February 10, 2007 ; accessed on September 19, 2018 .
further reading
- Nick Montfort: The Trivial Program “yes”, Trope Tank, Cambridge, Massachusetts January 2012. Retrieved August 13, 2018.
Web links
- Manpage for yes ( GNU version)
- GNU coreutils yes.c integration
- FreeBSD yes.c integration
- NetBSD yes.c integration
- OpenBSD yes.c integration