yes command in Linux with Examples

yes command in linux is used to print a continous output stream of given STRING. If STRING is not mentioned then it prints ‘y’;

Syntax:

yes [STRING]

Note: To stop printing please press Ctrl + C.

Question: Where it is used ?



Ans: Lets say that we want to delete all the .txt file present in the current directory. Insted of writting rm -i *.txt and then typing y at the end for every file, what we can do is we can use yes | rm -i *.txt.

Options:

  • yes –help : It displays help information.

  • yes –version : It displays version infromation.



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.