Skip to content
Home » Use command -V to Get the Inside Scoop on Any Command”

Use command -V to Get the Inside Scoop on Any Command”

The command -V command is used to check the path to and type of a command. It is often used to find out more information about a command or to verify that a command is available on the system.

Here are some examples of how command -V can be used:

To find the path to and type of the ls command:

$ command -V ls
ls is hashed (/bin/ls)

This tells us that the ls command is located at /bin/ls and that it has been “hashed,” which means that it has been added to a hash table for fast lookup by the shell.

To find the path to and type of the bash command:

$ command -V bash
bash is a shell (/bin/bash)

This tells us that the bash command is a shell located at /bin/bash.

To find the path to and type of an alias called itvraag.nl:

$ command -V itvraag.nl
itvraag.nl is aliased to `curl -L <https://itvraag.nl>'

This tells us that the itvraag.nl alias is an alias for the curl -L <https://itvraag.nl> command.

Keep in mind that command -V will only work for commands that are in directories listed in the PATH environment variable, or for aliases that have been defined in the current shell. If a command is not found, command -V will return an error message.

Examples

# Show the path to the 'ls' command
command -V ls
# Output: /bin/ls

# Show the path to the 'grep' command
command -V grep
# Output: /usr/bin/grep

# Show the path to the 'python3' command
command -V python3
# Output: /usr/bin/python3

# Show the path to the 'vim' command
command -V vim
# Output: /usr/bin/vim

Leave a Reply

Your email address will not be published. Required fields are marked *

3 × 2 =