Session and utilities

The yes command

Repeats a word endlessly (the letter y by default). Used to answer questions automatically.

Syntax

yes [texto]

Copy-ready examples

$ yes | head -n 3Three lines
$ yes vale | head -n 2With your own text

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • Without a pipe it floods the screen; use it with head or pipe it into a command.

Related commands

FAQ

What is yes for?

To answer yes to many questions in a row from a command.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course