LFCS · Question #701
The command used to determine a file's type is
The correct answer is C. file. The file command is used to determine the type of a file by examining its content and metadata.
Question
Options
- Atype
- Bfind
- Cfile
- DIs
How the community answered
(20 responses)- A5% (1)
- C95% (19)
Why each option
The `file` command is used to determine the type of a file by examining its content and metadata.
`type` is a shell builtin command that indicates how the shell will interpret a command name (e.g., as an alias, function, builtin, or external command), not for determining the content type of an arbitrary file.
`find` is used to locate files and directories within a filesystem based on various criteria like name, size, or modification date, but it does not determine the internal content type of a file.
The `file` command analyzes the content of a specified file using a database of magic numbers and heuristic tests to classify its type, such as ASCII text, ELF executable, image data, or compressed archive, providing a detailed description.
`ls` lists directory contents and displays file attributes like permissions, size, and modification dates, but it does not analyze the file's content to determine its inherent data type beyond what might be inferred from its name or permissions.
Concept tested: Determining file types
Source: https://man7.org/linux/man-pages/man1/file.1.html
Topics
Community Discussion
No community discussion yet for this question.