bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to search for commands


From: Pierre Gaston
Subject: Re: how to search for commands
Date: Tue, 24 Feb 2015 13:14:10 +0200



On Tue, Feb 24, 2015 at 7:11 AM, Dan Douglas <ormaaj@gmail.com> wrote:
On Mon, Feb 23, 2015 at 10:50 PM,  <garegin16@gmail.com> wrote:
> How do you search for commands? In powershell you have the get-command cmdlet. Is there anything equivalent in unix?

Depends on the type of command. For shell builtins, bash has `help':

    $ help '*ad'
    Shell commands matching keyword `*ad'

    read: read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N
nchars] [-p prompt] [-t timeout] [-u fd] [name ...]
        Read a line from the standard input and split it into fields.
    ...

To search for commands found in PATH (or functions or aliases) use
`type'. See `help type' for how to use it.

Searching for commands by package is OS-specific. e.g. in Gentoo
`equery f -f cmd pkg' will show "commands" belonging to a package.
Cygwin's equivalent is `cygcheck -l'. Pretty much every distro has
something similar.

--
Dan Douglas


There's also "compgen -c"  that will list all things that bash things as a "command" (which includes things like if), it lists the possible completion so you can also list everything starting with a "f" with "compgen -c f"

(also there's help-bash@gnu.org for these kind of questions)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]