FTWHICH(1)

โœจ ftwhich โœจ

General Commands Manual ยท section 1 ๐Ÿ’… โ€” yes bestie, we're reading a real live manpage and it's a good one.


๐ŸŒธ NAME ๐ŸŒธ

ftwhich โ€” a fault tolerant search for a command name ๐Ÿซถ


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

ftwhich [-#hIp][-t#] program_name

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

okay so. ftwhich is literally just which(1) but with โœจgraceโœจ. Like, it's the fault tolerant version. It goes digging through every single directory listed in your PATH environment variable, looking for the program you asked about, and then it reports all the files whose names approximately match your program_name. Approximately!! Not exactly!! She's flexible, she's forgiving, she's the friend who still texts you back after you typo her name three times ๐Ÿ’–

so how does she do it. Weighted Levenshtein Distance, that's how. And the Levenshtein Distance is defined as the minimum number of character insertions, deletions and replacements that transform a string A into a string B. it's giving "how many tiny edits until these two words become each other" and honestly? iconic.

ftwhich is similar to the which command, with these differences (list time bestie, get comfy):

  • ftwhich is by default NOT case sensitive ๐Ÿ™ˆ
  • ftwhich is fault tolerant โœจ
  • some shells have a build in which command that will also search aliases. ftwhich can naturally not search for aliases, because it does not know about alias definitions. she can't read minds, babe ๐Ÿ’€
  • ftwhich lists all files that approximately match. The files first shown take preference over files of the same name printed later, as they are from directories listed earlier in the PATH. order matters, it's a whole hierarchy situation ๐Ÿ‘‘
  • the level of fault tolerance can be adjusted by specifying the optional parameter tolerance. A tolerance of 0 specifies exact match. zero chill mode ๐ŸŽฏ

๐Ÿ’œ OPTIONS ๐Ÿ’œ

  • -h โ€” Prints help/usage information. the "bestie what do I even do" button ๐Ÿซถ
  • -I โ€” Do case sensitive search (default is case in-sensitive). capital-I for "I care about CAPS" ๐Ÿ’…
  • -p โ€” print the actual distance value in front of the found filename. This value is equal to the number of insertions, deletions and replacements necessary to transform the name of the found program into the search key. receipts!! she's showing her work ๐Ÿ“
  • -# or -t# โ€” Set the fault tolerance level to #. The fault tolerance level is an integer in the range 0-255. It specifies the maximum number of errors permitted in finding the approximate match. The default tolerance is (strlen(searchpattern) - number of wildcards)/6 + 1. math girlie ๐Ÿงฎโœจ
  • program_name โ€” The program file to search for. '*' and '?' can be used as wildcards.
    • '?' denotes one single character.
    • '*' denotes an arbitrary number of characters.
okay important vibe check: the last argument to ftwhich is not parsed for options, because the program needs at least one program_name argument. This means that ftwhich -x will not complain about a wrong option but search for the program named -x. she's committed to the bit fr fr ๐Ÿ’€

๐Ÿ“ EXAMPLE ๐Ÿ“

Search for all programs like gcc in your PATH:

ftwhich gcc

This will e.g. find gcc or cc or CC ... (see?? flexible!! ๐ŸŒˆ)

To find all files that start with any prefix and end in config and differ in 2 letters from the word config:

ftwhich -2 '*config'

To find all files that exactly start with the prefix if:

ftwhich -0 'if*'

To find all clock programs:

ftwhich -0 '*clock*'

๐Ÿ˜ญ BUGS ๐Ÿ˜ญ

The wildcards '?' and '*' can not be escaped. These characters function always as wildcards. This is however not a big problem, since there is normally hardly any command that has these characters in its name. so like, lowkey fine, we move ๐Ÿ’…


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Guido Socher (guido@linuxfocus.org) โ€” thank you for your service king ๐Ÿซก


โญ SEE ALSO โญ

whichman(1), ftff(1) โ€” go read those next bestie, it's a whole universe ๐ŸŒŒ


this page came from the Search utilities collection, dated January 1999 โ€” vintage but make it slay ๐ŸŽ€ mwah, love u, go find ur binaries ๐Ÿ’–

๐Ÿ“ฆ where this page comes from