Wednesday 22 May 2019

How to Use the yes Command on Linux

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



from How-To Geek http://bit.ly/2wdY7GI

No comments:

Post a Comment