Yes (Unix)

yes
Operating systemUnix and Unix-like
PlatformCross-platform
TypeCommand
Licensecoreutils: GPLv3+

yes is a command on Unix and Unix-like operating systems, which outputs an affirmative response, or a user-defined string of text, continuously until killed.

Overview

By itself, the yes command outputs 'y' or whatever is specified as an argument, followed by a newline repeatedly until stopped by the user or otherwise killed; when piped into a command, it will continue until the pipe breaks (i.e., the program completes its execution). However, if the user enters a string after 'yes,' yes will output the string the same as it would 'y,' similar to echo.

The version of yes bundled in GNU coreutils was written by David MacKenzie.[1]

The command is available as a separate package for Microsoft Windows as part of the GnuWin32 project[2] and the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities.[3]

Uses

yes can be used to send an affirmative (or negative; e.g. yes n) response to any command that would otherwise request one, thereby causing the command to run non-interactively.

Piping yes to a command with many user-confirmation prompts will automatically answer all of those prompts with "yes" (typing 'y' and pressing return).

The following commands

$ yes | sudo apt install foobar

will answer the prompts for confirmation with y, effectively installing foobar with sudo apt without any prompts.

This usage may be obsolete today, as most commands that would request response from the user have either a 'force' option (e.g., rm -f) or an 'assume-yes' option (for example,apt -y).

As an example, the following:

$ rm -f *.txt

is functionally equivalent to

$ yes | rm *.txt

The yes command in conjunction with the head command can be used to generate large volume files for means of testing. For example, executing

$ yes 1234567 | head -n1000 > file

results in a file consisting of 1000 lines each consisting of eight characters (1, 2, 3, 4, 5, 6, 7 and newline).

yes can be used as an easy way of generating CPU load. In 2006, for example, the yes command received publicity for being a means to test whether or not a user's MacBook is affected by the "Intermittent Shutdown Syndrome" bug, where a MacBook would randomly shut off without any user input. By running the yes command indefinitely twice via Terminal under Mac OS X, users were able to max out their computer's CPU, and thus see if the failure was heat related.[4][5]

Implementation and performance

The implementation of yes on different Unix and Unix-likes was consistently implemented with a simple while-loop. The GNU Project's implementation of yes was much faster than any other implementation, achieved by buffering its output, leading to more output per system call.[6][7] GNU's implementation may have been different to avoid infringing on the Unix copyright. The FreeBSD Project changed their implementation in 2017 to match GNU's implementation.[8]

References

  1. ^ yes(1) – Linux User Commands Manual
  2. ^ CoreUtils for Windows
  3. ^ Native Win32 ports of some GNU utilities
  4. ^ "Test for MacBook Random Shutdown Syndrome (RSS)". ZDNet. 2006-08-29. Archived from the original on June 5, 2010. Retrieved 2012-05-09.
  5. ^ "Testing your MacBook for Random Shut Downs". the apple files. 2006-08-02. Archived from the original on 2007-02-10. Retrieved 2008-01-16.
  6. ^ Endler, Matthias (2017-10-10). "A Little Story About the 'yes' Unix Command". Endler.dev. Archived from the original on 2022-01-25.
  7. ^ kjensenxz (2017-06-13). "r/unix - How is GNU 'yes' so fast?". Reddit. Archived from the original on 2021-10-30.
  8. ^ gahr (2017-06-13). "Improve yes' throughput" (commit). github.

Further reading

Read other articles:

Presidente della Repubblica delle Figi Nome originale(EN) President of the Republic of Fiji Stato Figi TipoCapo di Stato In caricaWiliame Katonivere (FijiFirst) da12 novembre 2021 Istituito5 dicembre 1987 Durata mandato3 anni, rinnovabili una volta Modifica dati su Wikidata · Manuale Il Presidente della Repubblica delle Figi è il capo di Stato delle Isole Figi, che sono una repubblica parlamentare con a capo un presidente con mandato triennale. Indice 1 Storia 2 Nomina 3 Lista dei...

 

 

Mark Stevensdalam The Dark Corner (1946)LahirRichard William Stevens(1916-12-13)13 Desember 1916Cleveland, Ohio, Amerika SerikatMeninggal15 September 1994(1994-09-15) (umur 77)Majores, SpanyolNama lainStephen RichardsTahun aktif1943–1987Suami/istriAnnelle Hayes ​(m. 1945⁠–⁠1962)​ (bercerai)Anak2 Mark Stevens (nama lahir: Richard William Stevens, 13 Desember 1916 – 15 September 1994) adalah seorang pemeran Ameri...

 

 

Cet article est une ébauche concernant un homme politique américain. Vous pouvez partager vos connaissances en l’améliorant (comment ?) selon les recommandations des projets correspondants. John Albion AndrewFonctionsGouverneur du Massachusetts3 janvier 1861 - 4 janvier 1866Nathaniel Prentice BanksAlexander H. BullockDéputé à la Chambre des représentants du MassachusettsBiographieNaissance 31 mai 1818WindhamDécès 30 octobre 1867 (à 49 ans)BostonSépulture Hingham Cemete...

この項目には、一部のコンピュータや閲覧ソフトで表示できない文字が含まれています(詳細)。 数字の大字(だいじ)は、漢数字の一種。通常用いる単純な字形の漢数字(小字)の代わりに同じ音の別の漢字を用いるものである。 概要 壱万円日本銀行券(「壱」が大字) 弐千円日本銀行券(「弐」が大字) 漢数字には「一」「二」「三」と続く小字と、「壱」「�...

 

 

Private liberal arts college in Los Angeles, California Occidental CollegeSeal of Occidental CollegeMottoOccidens Proximus Orienti (Latin)Motto in EnglishThe West is nearest the EastTypePrivate liberal arts collegeEstablishedApril 20, 1887; 137 years ago (April 20, 1887)Religious affiliationNon-sectarian (historically Presbyterian)Academic affiliationsNAICU[1]Annapolis GroupOberlin GroupCLACProject PericlesEndowment$575.8 million (2021)[2]PresidentHarry J. El...

 

 

Motorsport track in Italy Misano World Circuit Marco SimoncelliGrand Prix Circuit (2008–present)LocationMisano Adriatico, Province of Rimini, Emilia-Romagna, ItalyTime zoneCET (UTC+1)CEST (DST)Coordinates43°57′41″N 12°41′0″E / 43.96139°N 12.68333°E / 43.96139; 12.68333Capacity60,000 (MotoGP 2016 Official Race Day Attendance 100,496)FIA Grade2Broke ground1970Opened4 August 1972; 51 years ago (1972-08-04)Former namesAutodromo Santa Monica ...

The BrosPoster rilis teatrikalNama lainHangul부라더 Alih Aksara yang DisempurnakanBuladeo SutradaraChang You-jeongProduserYi Jae-minDitulis olehChang You-jeongHeo Seong-hyePemeranMa Dong-seokLee Dong-hwiLee HaneePenata musikKim Jun-seongPenyuntingKim Sun-minPerusahaanproduksiHong FilmSoo FilmDistributorMegabox Plus MTanggal rilis 02 November 2017 (2017-11-02) (Korea Selatan) Durasi102 menitNegaraKorea SelatanBahasaKoreaPendapatankotorUS$10,8 juta[1] The Bros ad...

 

 

Inuit community in Newfoundland and Labrador, CanadaHopedale AgvitukInuit communityHopedaleNickname: Place of the WhalesHopedaleLocation of Hopedale in LabradorCoordinates: 55°27′39″N 60°14′00″W / 55.46083°N 60.23333°W / 55.46083; -60.23333[1]CountryCanadaProvinceNewfoundland and LabradorRegionNunatsiavutSettled1782IncorporatedMay 12, 1969Government • TypeInuit Community Government • Mayor (AngajukKâk)Marjorie Flowers&...

 

 

This article relies largely or entirely on a single source. Relevant discussion may be found on the talk page. Please help improve this article by introducing citations to additional sources.Find sources: Puerto Rico at the 1992 Summer Olympics – news · newspapers · books · scholar · JSTOR (December 2009) Sporting event delegationPuerto Rico at the1992 Summer OlympicsIOC codePURNOCPuerto Rico Olympic CommitteeWebsitewww.copur.pr (in Spanish)in Bar...

Braille for transcribing written Japanese Kantenji漢点字⢱⢚⠷⣸⠓⢜Script type logographic StatusunofficialPrint basiskanjiLanguagesJapaneseRelated scriptsParent systemsNight writingBrailleJapanese BrailleKantenji Braille Kanji (Japanese: 漢点字, Hepburn: Kantenji, lit. Chinese dot characters) is a system of braille for transcribing written Japanese. It was devised in 1969 by Tai'ichi Kawakami (川上 泰一), a teacher at the Osaka School for the Blind [ja], and was...

 

 

  لمعانٍ أخرى، طالع نادي النهضة (توضيح).يفتقر محتوى هذه المقالة إلى الاستشهاد بمصادر. فضلاً، ساهم في تطوير هذه المقالة من خلال إضافة مصادر موثوق بها. أي معلومات غير موثقة يمكن التشكيك بها وإزالتها. (مارس 2016) النهضة القنيطرية شعار النادي الاسم الكامل النهضة الرياضية الق�...

 

 

Questa voce sull'argomento Stagioni delle società calcistiche italiane è solo un abbozzo. Contribuisci a migliorarla secondo le convenzioni di Wikipedia. Segui i suggerimenti del progetto di riferimento. Voce principale: Unione Sportiva Lecce. AS LecceStagione 1937-1938Sport calcio Squadra Lecce Allenatore Giovanni Battista Rebuffo Presidente M. Sforza Serie CEscluso (ritirato alla quarta giornata, è in seguito riammesso) Coppa ItaliaSecondo turno Maggiori presenzeCampionato: Na...

Island in Queensland, Australia Mount Adolphus IslandNative name: Muri or MoriA satelitte image of Mount Adolphus IslandA map of the Torres Strait Islands showing Mount Adolphus Island in the southeast waters of Torres StraitGeographyLocationAdolphus Channel, Cape York Peninsula, Northern AustraliaCoordinates10°38′13″S 142°39′07″E / 10.637°S 142.652°E / -10.637; 142.652ArchipelagoTorres Strait IslandsAdjacent toTorres StraitTotal islands1Area6.74 km2 (...

 

 

Cet article est une ébauche concernant la Colombie et un arbitre de football. Vous pouvez partager vos connaissances en l’améliorant (comment ?) les recommandations du Projet:Colombie. Óscar RuizRuiz en 2008FonctionArbitre FIFA (en)BiographieNaissance 1er novembre 1969 (54 ans)VillavicencioNom de naissance Óscar Julián Ruiz AcostaNationalité colombienneFormation Fundación Universitaria Autónoma de Colombia (d)Activités Arbitre de football, avocatPériode d'activité Depu...

 

 

Protein-coding gene in the species Homo sapiens KLF5Available structuresPDBOrtholog search: PDBe RCSB List of PDB id codes2EBTIdentifiersAliasesKLF5, BTEB2, CKLF, IKLF, Kruppel-like factor 5 (intestinal), Kruppel like factor 5External IDsOMIM: 602903; MGI: 1338056; HomoloGene: 37520; GeneCards: KLF5; OMA:KLF5 - orthologsGene location (Human)Chr.Chromosome 13 (human)[1]Band13q22.1Start73,054,976 bp[1]End73,077,541 bp[1]Gene location (Mouse)Chr.Chromosome 14 (mouse)[...

Synchronization mechanism In computer science, read-copy-update (RCU) is a synchronization mechanism that avoids the use of lock primitives while multiple threads concurrently read and update elements that are linked through pointers and that belong to shared data structures (e.g., linked lists, trees, hash tables).[1] Whenever a thread is inserting or deleting elements of data structures in shared memory, all readers are guaranteed to see and traverse either the older or the new stru...

 

 

Vidhan Sabha constituencyAmnour Assembly constituencyConstituency No. - for the Bihar Legislative AssemblyConstituency detailsCountryIndiaRegionEast IndiaStateBiharEstablished2008ReservationNone Elected year2020 Amnour Assembly constituency is an assembly constituency in Saran district in the Indian state of Bihar. Overview As per Delimitation of Parliamentary and Assembly constituencies Order, 2008, No. 120 Amnour Assembly constituency is composed of the following: Amnour and Maker communit...

 

 

Disambiguazione – Se stai cercando l'omonimo cantante siciliano, vedi Brigantony. «La Sicilia ha pagato un alto tributo di sangue: spero che adesso ci lascino lavorare in pace.» (Dal discorso del giorno del suo insediamento a Palermo come capo dell'Ufficio istruzione) Caponnetto (a destra) insieme a Giovanni Falcone e Paolo Borsellino nell'ottobre 1986 Antonino Caponnetto (Caltanissetta, 5 settembre 1920 – Firenze, 6 dicembre 2002) è stato un magistrato italiano, noto soprattutto per ...

2005 aviation accident Mandala Airlines Flight 091PK-RIM, the aircraft involved, seen at Soekarno–Hatta International Airport, in 2004.AccidentDate5 September 2005 (2005-09-05)SummaryCrashed shortly after take-off due to improper configurationSitePolonia International AirportMedan, North Sumatra, Indonesia 3°32′47″N 98°39′32″E / 3.5465°N 98.6589°E / 3.5465; 98.6589Total fatalities149Total injuries43AircraftAircraft typeBoeing 737-230 A...

 

 

19th century Greek secret society opposing Ottoman rule You can help expand this article with text translated from the corresponding article in French. (April 2015) Click [show] for important translation instructions. View a machine-translated version of the French article. Machine translation, like DeepL or Google Translate, is a useful starting point for translations, but translators must revise errors as necessary and confirm that the translation is accurate, rather than simply copy-p...