If I see a command in a script that I don't know and I type (for example) man pushd or man umask I see the man page for builtin commands. I know that I can do man bash and scroll to find the help for that builtin command, or I can open a browser and go to the online bash man page which is easier to search, but is there an easier way to get the man page for a single builtin command directly on the command line?

up vote 12 down vote accepted

Perhaps you like to have some wrapper function which skips directly to the builtin:

man -P "less +/\ \ \ pushd" bash

-P tells man to use less as pager (probably the default on most systems), but pass directly a search to it. You need to add some blanks before the search string to skip hits in text and go to the description of the command.

For convenience make a function out of it and put it into your ~/.bashrc:

function manbash {
   man -P "less +/\ \ \ $1" bash

and use it like manbash pushd.

Another possibility is to use the bash builtin help:

$ help pushd
pushd: pushd [-n] [+N | -N | dir]
Add directories to stack.

Adds a directory to the top of the directory stack, or rotates
the stack, making the new top of the stack the current working
directory.  With no arguments, exchanges the top two directories.

  • help command - perfect, thanks. Why the man builtins page doesn't suggest this I don't know! – jhabbott Apr 24 '13 at 11:28
  • 1
    @jhabbott: I just discovered help myself while writing my answer and thinking what would be a good name for the wrapper function... hm, help! Ok, lets check first if we will override some existing function - et voilà ;) – mpy Apr 24 '13 at 11:31

Would man bash-builtins be more helpful? Also, you can search within man pages by hitting / and entering your search term.

less also recognizes start-of-line anchor ^ and greedy matching operator *.

man -P "less '+/^ *'pushd" bash

manbb() {
   man -P "less '+/^ *'${1}" bash

manbb pushd

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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