Share to: share facebook share twitter share wa share telegram print page

Fortune (Unix)

fortune
Original author(s)Ken Arnold
Initial release1979; 45 years ago (1979)
Repository
Written inC
Operating systemUnix, Unix-like, Plan 9, Inferno
TypeCommand
LicensePlan 9: MIT License

fortune is a program that displays a pseudorandom message from a database of quotations. Early versions of the program appeared in Version 7 Unix in 1979.[1] The most common version on modern systems is the BSD fortune, originally written by Ken Arnold.[2] Distributions of fortune are usually bundled with a collection of themed files, containing sayings like those found on fortune cookies (hence the name), quotations from famous people, jokes, or poetry.

fortune is predominantly found on Unix-like systems, but clients for other platforms also exist.[3] Often, users on text-mode Unix terminals will place this command into either their .profile or .logout files to display them at logon and logout, respectively. It is also used to generate text input for certain XScreenSaver modes. It is possible to pipe fortune into the cowsay command, to add more humor to the dialog.

Content

Most Unix systems use fortunes which are slanted heavily toward the user base of Unix, and thus contain many obscure jokes about computer science and computer programming. Other favoured sources include quotations from science fiction (Star Trek, The Cyberiad, Doctor Who, The Hitchhiker's Guide to the Galaxy, etc.), Zippy the Pinhead, and the writings of Ambrose Bierce and Dave Barry.[4] Most fortune collections also include a wide variety of more conventionally sourced quotations, jokes, and other short passages. A few distributions include "offensive" dicta, which require the -a or -o options to be passed for viewing. These fortunes often include rude humor and profanity, personal attacks, and controversial comments about religion. Sometimes they are provided by another package, however as of FreeBSD 10.0 the offensive dicta have been removed completely.[5] As of November 2017, the quotations (with the exception of tips relevant to system operation) have been removed from FreeBSD entirely after user complaints regarding quotations from Adolf Hitler being contained in some of the files.[6] The exact fortunes vary between each type of Unix, however there seems to be a strong overlap between the FreeBSD and OpenBSD fortune files. The Plan 9 fortune files seem to be much shorter, with many just on 1 line, and the 'offensive' dicta is much stronger. Most Linux distributions, such as Debian (and its derivatives), choose the FreeBSD fortunes to put in their fortune packages, that can be installed through the package manager.

Purpose

One of the included fortunes, from the "goedel" collection of fortunes about fortune itself, sums up the purpose of the program:

Has anyone realized that the purpose of the fortune cookie program is to
defuse project tensions? When did you ever see a cheerful cookie, a
non-cynical, or even an informative cookie?
        Perhaps inadvertently, we have a channel for our aggressions. This
still begs the question of whether the cookie releases the pressure or only
serves to blunt the warning signs.

        Long live the revolution!
        Have a nice day.

The original fortune program could be used for the more general task of picking up a random line from a plain-text file.[7] However, in most modern Unix systems fortune cannot be used this way, since they use an ad hoc file format for fortune files to allow multiline aphorisms.

Fortune files

Conventional versions of fortune use two files for each quotation list: a text file with quotations, each separated by the character "%" on its own line, and a random-access data file generated by the strfile(1) program. Alternative implementations, including those made for display on Web pages, typically use only the text file.

Common options

Several common options exist that change the way command-line versions of fortune behave:

Option Action
-a Choose from all databases, regardless of whether they are considered "offensive" or not
-e Make the probability of choosing a fortune file equal to that of all other files
-f Print out a list of all fortune files that would have been searched, but do not print a fortune
-i When used with -m, make regular expression searching case-insensitive
-l Use only quotations longer than the length specified with -n, or 160 characters if -n is not used
-m [pattern] Print all fortunes matching the regular expression specified in [pattern]
-n [length] Override the length used by -l and -s to determine "long" and "short" messages (default 160 characters)
-o Choose only from "offensive" databases
-s Use only quotations shorter than the length specified with -n, or 160 characters if -n is not used
-w Wait for a period of time before terminating; useful for situations in which a fortune needs to be read before the screen is cleared

See also

References

  1. ^ "V7/usr/src/games/fortune.c". tuhs.org. Retrieved 2024-02-10.
  2. ^ "[base] Contents of /head/usr.bin/fortune/fortune/fortune.c". svnweb.freebsd.org. Retrieved 2018-09-15. This code is derived from software contributed to Berkeley by Ken Arnold.
  3. ^ "Jar of Fortune Files". fortunes.cat-v.org.
  4. ^ "Debian Sources: fortune 1:1.99.1-7, "datfiles" folder". sources.debian.org. Retrieved 2018-09-15.
  5. ^ "Fortune - removal log". FreeBSD SVN. FreeBSD. 2013-03-12. Retrieved 2014-06-14.
  6. ^ "[base] Revision 325828". svnweb.freebsd.org. 2017-11-14. Retrieved 2018-04-14.
  7. ^ Tom Duff. "rc documentation". plan9.bell-labs.com. Archived from the original on 2014-09-08. First, the program guesses a location (in $lab) using the fortune program to pick a random line from the location list.

Read other articles:

Kilo 2 (Jeddah)LingkunganNegaraArab SaudiProvinsiProvinsi MakkahPemerintahan • Wali kotaHani Abu Ras[1] • Gubernur kotaMish'al Al-SaudKetinggian12 m (39 ft)Zona waktuUTC+3 (AST) • Musim panas (DST)ASTKode pos(5 kode digit dimulai dari 23; e.g. 23434)Kode area telepon+966-12Situs webwww.jeddah.gov.sa/english/index.php Kilo 2 (Jeddah) adalah sebuah permukiman padat penduduk di kota Jeddah di Provinsi Makkah, tepatnya di sebelah barat Arab Saudi…

JNE

Artikel ini memiliki beberapa masalah. Tolong bantu memperbaikinya atau diskusikan masalah-masalah ini di halaman pembicaraannya. (Pelajari bagaimana dan kapan saat yang tepat untuk menghapus templat pesan ini) Artikel ini tidak memiliki referensi atau sumber tepercaya sehingga isinya tidak bisa dipastikan. Tolong bantu perbaiki artikel ini dengan menambahkan referensi yang layak. Tulisan tanpa sumber dapat dipertanyakan dan dihapus sewaktu-waktu.Cari sumber: JNE – berita …

Christopher A. Pissaridesoleh Magnus Rew 2014Lahir20 Februari 1948 (umur 76) Nicosia, CyprusKebangsaan Cyprus United KingdomInstitusiLondon School of Economics 1976-University of Southampton 1974-76BidangLabor economicsAlma materLondon School of EconomicsUniversity of EssexDipengaruhiMichio MorishimaDale MortensenKontribusiMacroeconomic Search and Matching Theories of UnemploymentMatching FunctionStructural GrowthPenghargaanIZA Prize in Labor EconomicsInformasi di IDEAS …

Independent film studio DisneynatureCompany typeDivisionIndustryFilmGenreNature filmsFoundedApril 21, 2008; 15 years ago (2008-04-21) in Burbank, California, U.S.HeadquartersParis, FranceArea servedWorldwideKey peoplePaul Baribault (VP & GM)[1]ProductsMotion picturesParentDisney EntertainmentWebsitenature.disney.com Disneynature is an independent film studio that specializes in the production of nature documentary films for Walt Disney Studios, a division of Disney …

Private college-preparatory school in Chantilly, Virginia, United StatesSt. Paul VI Catholic High SchoolAddress42341 Braddock RoadChantilly, Virginia 20152United StatesCoordinates38°54′20″N 77°32′18″W / 38.905492°N 77.538304°W / 38.905492; -77.538304InformationTypePrivate college-preparatory schoolMottoGrow in Grace & WisdomReligious affiliation(s)CatholicPatron saint(s)St. Francis de SalesSt. Jane de ChantalSt. Paul VIEstablished1983; 41 year…

Johnson ControlsJenispublik (NYSE: JCI)IndustriOtomotifKantorpusatMilwaukee, Wisconsin, Amerika SerikatWilayah operasiSeluruh duniaTokohkunciAlex A. Molinaroli(CEO)Situs webwww.johnsoncontrols.com Johnson Controls (NYSE: JCI) adalah sebuah perusahaan asal Amerika Serikat yang bergerak di industri otomotif.[1] Saat ini, markas pusat Johnson Controls terletak di 5757 N. Green Bay Ave., Milwaukee, Wisconsin, dan dipimpin oleh CEO Alex A. Molinaroli.[1] Pada tahun 2013, Johnson Contr…

Colombian television series (2006) For the NBC version, see Without Breasts There Is No Paradise. For the Telemundo version, see Sin senos no hay paraíso. For the Spanish version, see Sin tetas no hay paraíso (Spanish TV series). This article includes a list of general references, but it lacks sufficient corresponding inline citations. Please help to improve this article by introducing more precise citations. (November 2014) (Learn how and when to remove this template message) Sin tetas no hay…

Italian Egyptologist (1914–2015) Sergio DonadoniBornSergio Donadoni(1914-10-13)13 October 1914PalermoDied31 October 2015(2015-10-31) (aged 101)RomeNationalityItalianOccupationEgyptologistSpouseAnna Maria Roveri Fabrizio Sergio Donadoni OMRI (13 October 1914 – 31 October 2015)[1] was an Italian archaeologist who worked in the disciple of Egyptology. Life Born in 1914 in Palermo, he was fascinated by the ancient Egypt since childhood, with a particular interest on the Greco-Roman …

Promozione 1975-1976 Competizione Promozione Sport Calcio Edizione 9ª Organizzatore L.N.D.Comitati Regionali Luogo  Italia Formula 26 gironi all'italiana Cronologia della competizione 1974-1975 1976-1977 Manuale Nella stagione 1975-1976, la Promozione era il quinto livello del calcio italiano (il primo livello regionale). Il campionato è strutturato in vari gironi all'italiana su base regionale, gestiti dai Comitati Regionali di competenza. Promozioni alla categoria superiore e retrocessi…

Kapal selam Shchuka-B Proyek 971 dalam perjalanan di Laut Baltik K-152 Nerpa (bahasa Rusia: К-152 «Нерпа») adalah sebuah kapal selam penyerang tenaga nuklir dari Shchuka-B Proyek 971 (NATO: Akula II). Pembuatannya telah dimulai sejak tahun 1991, tetapi ditunda disebabkan oleh kekurangan dana. K-152 Nerpa telah diluncurkan pada bulan Oktober 2008 [1] dan akan disewakan kepada Angkatan Laut India pada tahun 2009 dan dinamakan sebagai INS Chakra. Nerpa adalah kata Rusia untuk an…

Katedral UrmiaGereja Katedral Katolik Kaldea Maria Bunda Allah di UrmiaPersia: کلیسای مریم مقدسMisa diadakan di Katedral UrmiaLokasiUrmiaNegaraIranDenominasiGereja Katolik Roma (sui iuris: Gereja Katolik Kaldea)AdministrasiKeuskupanEparki Agung Urmya Katedral Urmia (Persia: کلیسای مریم مقدس) atau yang bernama lengkap Gereja Katedral Katolik Kaldea Maria Bunda Allah di Urmia adalah sebuah gereja katedral Katolik yang terletak di kota Urmia, Iran. Katedral ini m…

For the community in Calaveras County, California, formerly with this name, see Big Meadow, California. For the community in Plumas County, California, formerly with this name, see Chester, California. United States historic placeBig Meadows SiteU.S. National Register of Historic Places Big Meadows in SummerNearest cityLuray, VirginiaArea0.1 acres (0.040 ha)NRHP reference No.85003172[1]Added to NRHPDecember 13, 1985 Big Meadows is a recreational area of the Shenandoah Nati…

Федеральное агентство по делам Содружества Независимых Государств, соотечественников, проживающих за рубежом, и по международному гуманитарному сотрудничествусокращённо: Россотрудничество Общая информация Страна  Россия Юрисдикция Россия Дата создания 6 сентября 20…

土库曼斯坦总统土库曼斯坦国徽土库曼斯坦总统旗現任谢尔达尔·别尔德穆哈梅多夫自2022年3月19日官邸阿什哈巴德总统府(Oguzkhan Presidential Palace)機關所在地阿什哈巴德任命者直接选举任期7年,可连选连任首任萨帕尔穆拉特·尼亚佐夫设立1991年10月27日 土库曼斯坦土库曼斯坦政府与政治 国家政府 土库曼斯坦宪法 国旗 国徽 国歌 立法機關(英语:National Council of Turkmenistan) 土…

2020年夏季奥林匹克运动会波兰代表團波兰国旗IOC編碼POLNOC波蘭奧林匹克委員會網站olimpijski.pl(英文)(波兰文)2020年夏季奥林匹克运动会(東京)2021年7月23日至8月8日(受2019冠状病毒病疫情影响推迟,但仍保留原定名称)運動員206參賽項目24个大项旗手开幕式:帕维尔·科热尼奥夫斯基(游泳)和马娅·沃什乔夫斯卡(自行车)[1]闭幕式:卡罗利娜·纳亚(皮划艇)[2…

2020年夏季奥林匹克运动会波兰代表團波兰国旗IOC編碼POLNOC波蘭奧林匹克委員會網站olimpijski.pl(英文)(波兰文)2020年夏季奥林匹克运动会(東京)2021年7月23日至8月8日(受2019冠状病毒病疫情影响推迟,但仍保留原定名称)運動員206參賽項目24个大项旗手开幕式:帕维尔·科热尼奥夫斯基(游泳)和马娅·沃什乔夫斯卡(自行车)[1]闭幕式:卡罗利娜·纳亚(皮划艇)[2…

American singer-songwriter Peter CincottiBackground informationBorn (1983-07-11) July 11, 1983 (age 40)New York City, U.S.GenresPop, rock, vocal jazzOccupation(s)SingerInstrument(s)Vocals, pianoYears active2000–presentLabelsConcord, 143 RecordsWebsitepetercincotti.comMusical artist Peter Cincotti (born July 11, 1983) is an American singer-songwriter. He began playing piano at the age of three. While in high school, he regularly performed in clubs throughout Manhattan. In 2003, Cincotti's …

密西西比州 哥伦布城市綽號:Possum Town哥伦布位于密西西比州的位置坐标:33°30′06″N 88°24′54″W / 33.501666666667°N 88.415°W / 33.501666666667; -88.415国家 美國州密西西比州县朗兹县始建于1821年政府 • 市长罗伯特·史密斯 (民主党)面积 • 总计22.3 平方英里(57.8 平方公里) • 陸地21.4 平方英里(55.5 平方公里) • …

This article is about the Beatles song. For other uses, see All My Loving (disambiguation). 1963 song by the BeatlesAll My LovingCanadian picture sleeveSong by the Beatlesfrom the album With the Beatles Released22 November 1963Recorded30 July 1963StudioEMI, LondonGenrePop rock[1][2]Length2:04LabelParlophone (UK)Songwriter(s)Lennon–McCartneyProducer(s)George MartinAudio samplefilehelp All My Loving is a song by the English rock band the Beatles, from their second UK album With t…

Artikel ini sebatang kara, artinya tidak ada artikel lain yang memiliki pranala balik ke halaman ini.Bantulah menambah pranala ke artikel ini dari artikel yang berhubungan atau coba peralatan pencari pranala.Tag ini diberikan pada Februari 2023. Ragam bentuk patung Ana Deo Ana Deo adalah patung yang merupakan salah satu benda pusaka etnik Lio Ende. Masyarakat Lio ini berdiam di Ende, Flores, Nusa Tenggara Timur (NTT).[1] Ana Deo berkaitan erat dengan kepercayaan asli masyarakat Lio. Patu…

Kembali kehalaman sebelumnya