commands

command — inspect command resolution

Bash builtin. With -v it describes how a name is resolved; with -V it gives a more detailed description. Without either, it invokes the requested command while bypassing shell functions. Do not assume -v always prints an absolute filename.

Formal Syntax & Structure

linux syntaxlinux
command [-pVv] command [argument ...]

Parameters & Attributes

NameTypeDescription
-voptionConcise lookup result
-VoptionVerbose lookup result
-poptionUse a default search path
commandoperandName to inspect or invoke
argumentoperandArguments for invocation

Return Value

text and exit status

Lookup mode succeeds when the name is found; otherwise nonzero. Invocation returns the command status or a lookup/execution failure.

Working Example

Example Snippetlinux
command -v cdcommand -v ls
Linux Reference