LFCS · Question #665
Which of the following commands shows the definition of a given shell command?
The correct answer is C. type. The type command is used to determine how a command name will be interpreted by the shell.
Question
Options
- Awhere
- Bstat
- Ctype
- Dcase
How the community answered
(29 responses)- B3% (1)
- C93% (27)
- D3% (1)
Why each option
The `type` command is used to determine how a command name will be interpreted by the shell.
`where` is not a standard shell command for displaying command definitions in typical Linux/Unix environments; `which` or `whereis` are used to locate executables, but `type` provides the shell's interpretation.
The `stat` command displays detailed information about file or filesystem status (e.g., size, permissions, ownership, timestamps), but not the shell's interpretation of a command.
The `type` command displays whether a given command is an alias, shell function, built-in command, or an external executable, and provides its path if it is an executable.
`case` is a shell control flow construct used for conditional execution, not a command to query command definitions.
Concept tested: Shell command introspection
Source: https://linux.die.net/man/1/type
Topics
Community Discussion
No community discussion yet for this question.