Repeat Text Endlessly With yes
Stream an unending line of text for testing or to feed interactive prompts.
Run yes "text" | head -n 5 to print the text five times.
01Command
Command
$ yes "cmdcv" | head -n 502What it does
yes prints its arguments (y by default) forever until interrupted. A common trick is piping it into a program that asks many confirmation questions, or into head to generate a fixed number of lines. Always cap it with head or a length limit.
03Risk
!Warning: yes on its own never stops and can fill a disk or spam a log if redirected to a file; always bound it.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- yes: Output a string repeatedly — GNU coreutilsEvidence: Documents yes, which repeats its arguments until killed.
Last verified: 2026-09-20 · Category: Developer
06Related solutions
Change where screenshots are saved on Mac
Point macOS screen captures at any folder you choose instead of the desktop.
Download a file from a URL on Mac with curl
Grab any file from the web straight into the current folder — no browser needed.
Find files larger than 500 MB on Mac
List the biggest files in your home folder that are eating disk space.