LX0-103 · Question #101
The command used to determine a file's type is
The correct answer is C. file. The file command inspects a file's internal content and magic bytes to determine its actual type, independent of its extension.
Question
The command used to determine a file's type is
Options
- Atype
- Bfind
- Cfile
- DIs
How the community answered
(37 responses)- A3% (1)
- B3% (1)
- C89% (33)
- D5% (2)
Why each option
The `file` command inspects a file's internal content and magic bytes to determine its actual type, independent of its extension.
The `type` command is a shell built-in that identifies how a command name is interpreted by the shell (as an alias, function, or external binary), not the content type of a file.
The `find` command searches directory hierarchies for files matching criteria such as name, size, or modification time, but does not analyze or report the internal content type of a file.
The `file` command reads a file's content, including magic numbers and structural signatures, to identify its true type (e.g., ELF binary, ASCII text, JPEG image). It is the standard Unix/Linux utility for this purpose and works regardless of the filename or extension.
`ls` (rendered here as 'Is' due to a font artifact) lists directory contents and basic file metadata such as size and permissions, but does not identify a file's internal format or content type.
Concept tested: Linux `file` command for identifying file content types
Source: https://man7.org/linux/man-pages/man1/file.1.html
Topics
Community Discussion
No community discussion yet for this question.