info bash
and man bash
only document Bash's own features.
External utilities such as date
have nothing to with Bash per se, even though you can call them from Bash.
For any given external utility you'll find documentation in its specific man
and info
pages (if installed), as you've discovered.
What muddles the issue is that Bash has so-called builtins that look and behave like external utilities in many respects - those have specific help topics that you can invoke with help
; e.g., help read
, but you can also find them in man bash
under the heading SHELL BUILTIN COMMANDS
.
Furthermore, some command names, e.g. echo
, exist both as Bash builtins and as external utilities (/bin/echo
).
While just info
(without arguments) will show you a list of external utilities, typically under heading Individual utilities
, there are problems; depending on your system:
The list may be incomplete, or spread across multiple locations.
The documentation may not refer to the actual utilities installed on your system.
- For instance, on OSX the
info
topics document the GNU core utilities, whereas OSX mostly comes with BSD utilities.
If, however, your system is a Linux distro that does use the GNU utilities (which is the norm) and the info
command is the one that came with bash
, you may be fine.
See below for commands that allow you to find all external utilities in your $PATH
.
An alternative way to get a list of external utilities is to consult the set of POSIX-mandated utilities; note that this list will only be a subset of the set of utilities installed on most modern platforms; similarly, the individual utility description will typically only describe the - standardized - subset of a given platform's version of that utility, because most utilities implement nonstandard extension:
- Go to Shell & Utilities: Detailed Toc and search for heading
Utilities
(as the full heading), which lists all external utilities a POSIX-compliant system must have.I couldn't find a direct link to a page listing all utilities by name.
- POSIX also mandates the builtins (built-in utilities) that a POSIX-compliant shell must implement (of which the Bash builtins are a superset):
Additional information:
- To see whether a given command is a builtin, use, e.g.:
$ type read
read is a shell builtin
- To see all forms of a command, use option
-a
, e.g.:
$ type -a read
read is a shell builtin
read is /usr/bin/read
How to find all (external) utilities in your $PATH
:
printf '%s' "$PATH" | tr ':' '\n' | xargs -I {} find {} -maxdepth 1 -type f -perm -o=x
- If you want a sorted list of mere executable names, use:
printf '%s' "$PATH" | tr ':' '\n' | xargs -I {} find {} -maxdepth 1 -type f -perm -o=x |
awk -F/ '{ print $NF }' | sort -u
- The above lists only unique names; it is possible for distinct duplicates of executables with the same filename to exist in multiple directories in the
$PATH
(in which case the one whose directory comes first in $PATH
"wins"); to see a list of duplicates, prefixed with their occurrence count, use:
printf '%s' "$PATH" | tr ':' '\n' | xargs -I {} find {} -maxdepth 1 -type f -perm -o=x |
awk -F/ '{ print $NF }' | sort | uniq -c | grep -v ' *1'
- For any given name with duplicates you can use
which -a <name>
to see the full paths of all duplicates.
Finally, tab completion can be helpful in discovering commands:
Type man
and press the Tab key repeatedly to list / cycle through all command; specify a command prefix - e.g., man dat
- to only list / cycle through the commands that start with that prefix (the exact behavior depends on your readline
configuration).
- By default this does not work with
info
(at least on the OSX and Ubuntu systems that I've tried this on from Bash).
This also works when starting to type a command name to invoke.
- However, that requires typing at least one letter, which limits the matches to commands whose name starts with that letter.
- To discover all executables in a given folder, use:
./<tab>
in the current folder.
/usr/bin/<tab>
, for instance, in a specific folder.