Linux Command Definition - How to View Shell Command Definitions

View Shell Command Definitions

Question

Which of the following commands shows the definition of a given shell command?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

C

The correct answer is C. type.

The type command is used to display the type of a command. It will display the location of the command binary file and also the type of command it is, i.e., whether it is a shell builtin, an alias, or an external command.

For example, if you want to know the definition of the ls command, you can run:

shell
$ type ls

The output will be something like:

vbnet
ls is aliased to 'ls --color=auto' ls is /bin/ls

This means that ls is an alias for the command ls --color=auto, and the binary file for the ls command is located in the /bin directory.

Option A, where, is not a valid command. The correct command for this purpose would be whereis, which displays the location of the binary, source, and manual page files for a given command.

Option B, stat, is used to display the status of a file or filesystem. It is not used to display the definition of a command.

Option D, case, is not a command at all. It is a keyword used in shell scripting to perform conditional branching based on the value of a variable.