Yes (Unix)
Encyclopedia : Y : YE : YES : Yes (Unix)
- The correct title of this } is }}}. The initial letter is capitalized due to [Naming conventions #Lower case first lettertechnical restrictions].
Purpose
Outputs an affirmative response or a string of text continuously until killed.
Syntax
yes [ STRING ] yes OPTION
Options
--helpDisplays help and exits
--versionOutputs version information and exits
Description
By itself, the yes command outputs 'y' or whatever is specified as the STRING argument (above), followed by a newline, 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 proccess 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%.
Uses
yes can be used to send an affirmative response to any command that would otherwise request one, and thereby causing the command to run non-interactively.
(Note, this may be deprecated - the vast majority of commands that would request response from the user have either a 'force' option (e.g., 'rm -f') or an 'assume-yes' option (e.g., 'apt-get -y' in Debian).)
Example
To display the word first to the screen, type:
yes firstThis statement displays the word, once per line, until killed.
| Unix command line programs ( ) | |||
| File and file system management: | cat | chdir/cd | chmod | chown | chgrp | cp | du | df | fdupes | file | fsck | ln | ls | lsof | mkdir | more | mount | mv | pwd | rcp | rm | rmdir | split | touch | tree | ||
| Process management: | anacron | at | chroot | cron/crontab | kill | nice | ps | sleep | time | timex | top | renice | wait | ||
| User Management/Environment: | env | finger | id | locale | mesg | passwd | su | sudo | uname | uptime | w | who | write | ||
| Text processing: | awk | cut | diff | ex | head | iconv | join | less | more | nkf | paste | sed | sort | tail | tr | uniq | wc | xargs | ||
| Shell programming: | echo | expr | unset | Printing: | lp |
| Communications: inetd | netstat | ping | rlogin | traceroute | Searching: egrep | fgrep | find | grep | strings | Miscellaneous: banner | bc | cal | man | uname | wall | yes | |
From Wikipedia, the Free Encyclopedia. Original article here. Support Wikipedia by contributing or donating.
All text is available under the terms of the GNU Free Documentation License See Wikipedia Copyrights for details.
