From Linux Shell Scripting Tutorial - A Beginner's handbook
Jump to navigation Jump to search

The command is an internal bash shell command (a shell builtin). One can use the command to execute a simple command or display information about commands. You can also temporarily bypass an alias in bash.


The syntax is:

command command
command [-pVv] command
command [-pVv] command [arg1 arg2 ...]


To see all locations containing an executable named ls i.e ls COMMAND:

command -v ls

Sample outputs:

alias ls='ls --color=auto'

To see a more verbose description of ls COMMAND

command -V ls

Sample outputs:

ls is aliased to `ls --color=auto'

Another useful use is to disable an alias created by an alias command temporarily and call the core command directly using command COMMAND. For example, on my system the following alias set:

alias apt-get='apt-get update && apt-get upgrade'

To ignore apt-get alias, enter:

command apt-get -y install foo

You can also use any one of the following syntax on bash

\apt-get -y install
"apt-get" -y install

External link