yes command in Linux

There is an interesting command in Linux:

yes y

It generates an infinite stream of letters ‘y’ and presses enter after each of it
This way you can install multiple packages in one line:

yes y | yum install sudo mc nano

I didn’t know it and got used to install every package separately.

By a strange coincidence at this very moment I’m reading a chapter of “Effective Java” about Infinite Streams.

P.S. another way to achieve this is like this:

yum install -y sudo mc nano

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.