Search code examples
bashbash-completion

Where is the list of users returned from bash completion sourced from?


For example, typing compgen -u on an Ubuntu box returns a list of users. This includes more users than are listed in /etc/passwd . So the question is when using bash completion to list out users, where does the list come from?


Solution

  • You can run strace -o compgen.out bash -c 'compgen -u' and then look at the compgen.out file to try to find out what it is using.

    On my machine that file ends with an open("/etc/passwd", O_RDONLY) followed by the writing of the output.