How To Yes To All In Linux

Whether you’re a seasoned developer or a beginner dabbling in Linux, you’ve probably encountered a situation where you’re prompted for a ‘yes’ or ‘no’ response during script execution, package installations, or system updates. And, in cases where multiple confirmations are required, it can be quite tedious to manually enter ‘yes’ for each of them. This is where the ‘yes’ command in Linux comes into play. This command allows you to automatically respond ‘yes’ or ‘no’ to all prompts. In this blog post, we will guide you on how to use the ‘yes’ command in Linux.

What is the ‘yes’ command?

The ‘yes’ command is a command line utility that prints a specified string continuously until killed. By default, if you do not specify a string, it will constantly print ‘y’. This can be very useful when you run a command that requires multiple confirmation prompts.

How to use the ‘yes’ command?

Using the ‘yes’ command is straightforward. If you want to auto-confirm all prompts with ‘yes’, simply type ‘yes’ and then pipe the command you want to run. For example:

    yes | command

This command will print ‘y’ to standard output until the ‘command’ finishes execution. In cases where ‘command’ requires multiple ‘yes’ confirmations, ‘yes’ will provide them all. If you want to auto-confirm with ‘no’, just specify ‘n’ after ‘yes’:

    yes n | command

Examples of the ‘yes’ command

Let’s consider a real-world scenario. If you’re installing a package using apt-get (assume the package name is ‘example-package’), which requires multiple confirmations, you can use the ‘yes’ command like this:

    yes | sudo apt-get install example-package

This command will automatically provide ‘yes’ to all confirmation prompts during the package installation.


As you can see, the ‘yes’ command is a powerful tool in Linux that can save you from the hassle of manually confirming multiple prompts. It’s simple, yet it enhances the efficiency of your tasks. Happy Linuxing!