Shell
command
Run a command while bypassing shell functions.
shellbuiltinpathscript
Additional Notes
command is a shell builtin that runs a command while bypassing shell functions. It can also check how a command would be resolved.
Use it in scripts and wrapper functions when you need the real command lookup instead of a function with the same name.
Syntax
command [options] name [arguments...]
Parameters
name: Command name to run or inspect.arguments: Arguments passed to the command.options: Lookup and verbosity flags.
Common Options
-v NAME: Print how NAME would be resolved.-V NAME: Print a more verbose description.-p: Use a default PATH guaranteed to find standard utilities on some shells.
Examples
command -v python3
Check whether python3 is available.
command -V cd
Show whether cd is a builtin, function, alias, or executable.
ls() { command ls --color=auto "$@"; }
Define a wrapper while still calling the real ls.
Practical Notes
commandbypasses shell functions but not necessarily shell builtins.- Use
builtinwhen you specifically need a shell builtin. command -vis often better thanwhichin portable shell scripts.