nerdexam
Linux_Foundation

LFCS · Question #860

Which of the following commands determines the type of a file by using a definition database file which contains information about all common file types?

The correct answer is C. file. The file command is used to determine the type of a file by analyzing its content and comparing it against a predefined database of patterns and magic numbers.

Submitted by akirajp· Apr 18, 2026Essential Commands

Question

Which of the following commands determines the type of a file by using a definition database file which contains information about all common file types?

Options

  • Amagic
  • Btype
  • Cfile
  • Dpmagic
  • Ehash

How the community answered

(30 responses)
  • B
    3% (1)
  • C
    93% (28)
  • E
    3% (1)

Why each option

The `file` command is used to determine the type of a file by analyzing its content and comparing it against a predefined database of patterns and magic numbers.

Amagic

`magic` refers to the database that the `file` command uses for identification, not a standalone command itself.

Btype

The `type` command in Bash indicates how the shell interprets a command (e.g., built-in, alias, external program), rather than determining the data type of a file.

CfileCorrect

The `file` command analyzes the content of a file, including its header and structure, and compares these against a `magic` database (e.g., `/usr/share/misc/magic`) containing definitions for various file types to accurately report its classification.

Dpmagic

`pmagic` is not a standard Linux command used for identifying file types.

Ehash

The `hash` command is used by the shell to manage a hash table of command locations to speed up execution, not to determine the type of a file.

Concept tested: file command for type identification

Source: https://man7.org/linux/man-pages/man1/file.1.html

Topics

#file command#file type identification#basic commands

Community Discussion

No community discussion yet for this question.

Full LFCS Practice