0

The yes command seems too simple to be of any practical use, but in this tutorial, we’ll show you its application and how to benefit from its pent-up positivity in Linux and macOS.

The yes Command

The yes command is one of the simplest commands in Linux and other Unix-like operating systems like macOS. And by simple, we mean simple in its use and its initial implementation. The source code for the original version—released in System 7 Unix and authored by Ken Thompson—amounts to a mere six lines of code.

But don’t write it off for being a simple little command. It can be used in some interesting and useful ways.

What Does yes Do?

Used without any command line parameters, the yes command behaves as though you were typing “y” and hitting Enter, over and over (and over and over) again. Very quickly. And it will carry on doing so until you press Ctrl+C to interrupt it.

yes

output from yes in a terminal window

In fact, yes can be used to repeatedly generate any message you choose. Simply type yes, a space, the string you wish to use, and then press Enter. This is often used to cause yes to generate an output stream of “yes” or “no” strings.

yes yes

output from yes yes in a terminal window

yes anything you like

output from yes with a line of text in a terminal window

But What Use Is That?

Read the remaining 40 paragraphs


Post a Comment Blogger

We welcome comments that add value to the discussion. We attempt to block comments that use offensive language or appear to be spam, and our editors frequently review the comments to ensure they are appropriate. As the comments are written and submitted by visitors of The Sheen Blog, they in no way represent the opinion of The Sheen Blog. Let's work together to keep the conversation civil.

 
Top