commandэто встроенный bash, как мы можем видеть:
seth@host:~$ type command
command is a shell builtin
Итак, мы знаем, commandчто обеспечивается нашей оболочкой, bash. Покопавшись, man bashмы увидим, в чем его польза:
(с man bash):
command [-pVv] command [arg ...]
Run command with args suppressing the normal shell function
lookup. Only builtin commands or commands found in the PATH are
executed. If the -p option is given, the search for command is
performed using a default value for PATH that is guaranteed to
find all of the standard utilities. If either the -V or -v
option is supplied, a description of command is printed. The -v
option causes a single word indicating the command or file name
used to invoke command to be displayed; the -V option produces a
more verbose description. If the -V or -v option is supplied,
the exit status is 0 if command was found, and 1 if not. If
neither option is supplied and an error occurred or command
cannot be found, the exit status is 127. Otherwise, the exit
status of the command builtin is the exit status of command.
По сути, вы бы использовали, commandчтобы обойти "нормальный поиск функции". Например, скажем, у вас есть функция в вашем .bashrc:
function say_hello() {
echo 'Hello!'
}
Обычно, когда вы запускаете say_helloв своем терминале, bash найдет функцию, названную say_helloв вашем, .bashrc прежде чем найдет, скажем, приложение с именем say_hello. С помощью:
command say_hello
заставляет bash обходить свой обычный поиск функций и переходить прямо к встроенным или вашим $PATH. Обратите внимание, что поиск этой функции также включает псевдонимы. Использование commandбудет обходить как функции, так и псевдонимы.
Если -pопция включена, bash обходит ваши $PATHнастройки и использует их по умолчанию.
Команды -vor -Vflags bash выводят описание (короткое для -v, длинное для -V) команды.
Примечание. Как указывал souravc в комментариях, более простой метод поиска информации о встроенных командах оболочки можно найти здесь: Как заставить `man` работать для встроенных команд оболочки и ключевых слов?