3

My man page for 'whatis' does not match others I have found online. Namely, no options are available to use with it.

/home/User$ whatis -d ls
whatis: -d: unknown option
uname -srv
Darwin 16.7.0 Darwin Kernel Version 16.7.0: Sun Jun  2 20:26:31 PDT 2019; root:xnu-3789.73.50~1/RELEASE_X86_64

My first thought is that I could update bash, but it's not a builtin command so I don't know if that would work. Only been working with CLI for a few days now, and unsure how to even troubleshoot. I am also worried troubleshooting could lead to bugging my computer somehow.

patbarron
  • 1,156
  • 6
  • 17

1 Answers1

8

You appear to be on a Mac. Some of the online pages will be for other UNIX-like systems. Many of them will be Linux-centric (more specifically, GNU-centric) without necessarily realising so.

The definitive solution for any given command is to use your installed reference documentation. For example, man whatis to see the page for your own installed version of whatis.


This isn't about updating commands to get extra flags and options; it's that there are different implementations of what appear on the surface to be the same commands. As a Mac user you can get GNU versions of many of the standard commands through an add-on package system called homebrew. I don't use it myself but you can find out more about it at https://brew.sh/

roaima
  • 107,089
  • 14
  • 139
  • 261
  • So if my ```man whatis``` page has no options listed, is updating my OS the best way to potentially change that? – Samuel Patterson Oct 12 '20 at 15:14
  • 1
    The question is, "update your OS" to what? I don't think even later versions of MacOS are going to change this. MacOS provides old versions of many tools (including bash), so the options the tools take may differ from what you're expecting. You'll find it difficult to actually replace things provided with the OS (such as bash, whatis, etc.) because Apple's System Integrity Protection will get in your way - they *really* don't want you to do this... You could entirely replace MacOS with something like Debian, but that is probably not the solution you're after. – patbarron Oct 12 '20 at 15:33
  • On Mac OS 10.9 the `man` page tells: "The whatis database is created using the command `/usr/libexec/makewhatis`". If your goal is to update the `whatis` database on your Mac OS you might want to lookup your `makewhatis` (for example using `locate makewhatis`) – Pro Backup Oct 12 '20 at 20:01
  • 2
    @ProBackup I don't think this is anything do to with updating the `whatis` database. It seems to be more a case of a utility missing features that are available on other platforms – roaima Oct 12 '20 at 20:10
  • It is not the case that MacOS provides "old versions of tools". The BSD tools are _different_ tools, with different histories and different features, but are in general as up-to-date as any others. There are _many different toolsets_ in existence, from [man-db](http://man-db.nongnu.org) through `whatis` in [FreeBSD](https://freebsd.org/cgi/man.cgi?query=whatis) to [Illumos](https://illumos.org/man/1/whatis), [Schilix](http://schillix.sourceforge.net/man/man1/whatis.1.html) and [AIX](https://ibm.com/support/knowledgecenter/en/ssw_aix_71/w_commands/whatis.html). There is not one single tool. – JdeBP Oct 13 '20 at 06:56
  • Also note that man-db is not a "GNU version" of anything, and its selling point of using Berkeley DB is in fact _also_ a feature of _other_ implementations of these tools, including [mandoc](https://mandoc.bsd.lv/) for starters. – JdeBP Oct 13 '20 at 07:00
  • @JdeBP I believe that's pretty much what I've already said in my answer: that there are GNU alternatives to the _standard commands_ (supplied in Darwin), and "_there are different implementations of what appear on the surface to be the same commands_" – roaima Oct 13 '20 at 07:13
  • Contrast "there are GNU alternatives" with [man-db](http://man-db.nongnu.org) not being a GNU version of anything, it being on the _non-GNU_ Savannah. You'll be hard pressed to find a GNU version of the `whatis` command. (-: It's a little mis-leading moreover to call `whatis` a "standard command", the _SUS_ not in fact including either it or a `-f` option to `man`. Also notice what patbarron is claiming. – JdeBP Oct 13 '20 at 07:46
  • @JdeBP you're now being overly picky. (1) Looking at a Linux-based distribution I see the `man-db` package with a GNU licence. (2) If a command is included as standard in a particular distribution or implementation of a particular base OS, how _in the context of that base OS_ is that not a standard command? We're into semantics now rather than value – roaima Oct 13 '20 at 08:28