Forrest logo
back to the command tool

command:tldr:105ad

command: Display the path to the executable or the alias definition of a specific command.
$ command -v ${command_name}
try on your machine

The command "command -v ${command_name}" is used to determine the path of a particular command or program in the system.

Here's a breakdown of the command:

  • "command" is a built-in shell command/tool that allows you to execute a command without any shell function or alias overriding it.
  • "-v" is an option/flag for the "command" tool that tells it to display the location of the specified command (command_name) if it exists in the system.

"${command_name}" is a placeholder that represents the name of the command you want to find the path for. You need to replace it with the actual command name.

When you run this command in the terminal with a specific command name, it will search for the command in the system's directories (as specified in the "PATH" environment variable) and display the path to the command if it is found. If the command is not found or it is not executable, it will not output anything.

For example, if you run "command -v ls", it will display the path to the "ls" command if it exists in the system.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the command tool