I'm running CentOS 7.0 build 1503. I'm trying to search for commands I don't know the name of by searching the man descriptions for multiple keywords using AND (e.g. search for a command containing the both words "create" and "group" in the description).

So I came across the command apropos (which is an alias for man -k). The default behaviour when given multiple keywords is to return any command matching any of the keywords, which isn't what I want. According to the man page the option -a specifies using AND, to return matches only when all words match.

But this isn't what I'm seeing in practice, so I need some help here - e.g. using Centos 7, if I do:

apropos create user

I see a huge list of commands, seemingly matching any command with create or user in the description, as expected. Noting the list includes an entry for the command 'useradd (8) - create a new user...'.

If I do:

apropos -a create user

I only get 2 commands (environ and open). This is what I'm confused by - I would expect it to return the command 'useradd (8) - create a new user', because i can see from the previous search that command does contain those words in the description. Also the 2 returned commands don't obviously seem to be anything about creating users. What am I doing wrong? I'm sure it's something embarrassingly obvious, for that I apologise in advance.


  • 1
    What operating system are you using? I get newusers,pam_mkhomedir, rmsginit and useradd for apropos -a create user on Debian. – terdon Jun 25 '15 at 17:31
  • Hmm that's weird. I'm using Centos 7 (build 1503), just installed today and have done yum update. I get newusers when I do 'apropos newusers', but not when i do 'apropos -a create user' – James Allen Jun 25 '15 at 17:42
  • Well, then the man page probably doesn't contain that string. What does man newusers | grep create | grep user return? – terdon Jun 25 '15 at 18:21
  • 1
    Looks like it's fixed in more recent versions of man-db. CentOS 7 has version 2.6.3, from 2012, and I can reproduce the bug. Version seems to have a working -a option. As a workaround, you can do comm -12 <(apropos create|sort) <(apropos user|sort) – Mark Plotnick Jun 25 '15 at 18:30
  • Thanks Mark, if you make your comment an answer I'll accept it. I'd like to fix. Just downloaded from savannah project but I get stuck at ./configure - libpipeline version is too old. Am I about to go down a rabbit hole of upgrading dependencies (I'm new to Linux, I think the windows term is DLL hell)? – James Allen Jun 26 '15 at 15:45

The apropos command reads from a cache. It's possible that recently-installed man pages are not yet referenced in that cache. Generally the cache is updated either after each package installation or in a cron job, I don't know how it's set up on CentOS.

To update the cache, run mandb. There may be a prefered way to run it on your distribution (e.g. as a dedicated user), see if you have a system crontab entry (e.g. /etc/cron.daily/man-db or a line in /etc/crontab) and if you do, run that instead of calling mandb directly.

| improve this answer | |
  • Interesting idea, thanks for the info - unfortunately running mandb didn't help things. I believe this is a bug in the version I have (see Mark's comment) and as I'm still super new to Linux cron looks a bit too gnarly for me right now! I'm on a home play VM so I'm not too worried about screwing my system and starting again. – James Allen Jun 26 '15 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.