A downloaded file is called `data` with no extension. Which command inspects its content and reports what kind of file it is?

LPIC-1 Exam 101-500, objective 103. GNU and Unix commands easy

Machine-checked — no person has signed for it. This question was read against the source cited below by an automated pass, which found no contradiction. That is a weaker claim than it sounds: the same kind of process wrote the question, so it can confirm its own mistake.

Treat it as a good draft rather than as settled fact, and read the source below before you rely on it. It is not used in mock exams here — only questions a person has signed for are.

How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.

The options

Not correct ls -l data

Wrong. ls -l shows permissions, owner, size and mtime, and the leading character only distinguishes regular file, directory, symlink and so on — never the content format.

Correct file data

Correct. file examines the content — magic numbers and structure — and reports for example 'gzip compressed data' or 'ELF 64-bit LSB executable'.

Not correct stat data

Wrong. stat prints inode metadata: size, blocks, device, permissions and the three timestamps. It never looks at the data itself.

Not correct type data

Wrong. type is a bash builtin that says how a COMMAND name would be resolved (alias, builtin, function, or a path from PATH). It says nothing about a file given by path.

Why

On Linux the extension carries no meaning to the system, so `file` is the tool that answers 'what is this really'. It reads the beginning of the file and matches it against the magic database. If you need to look at the bytes yourself, od -c or hexdump -C is the next step.

Where this comes from

Cited
LPI exam objective 103.3
What it says
Determine the type of a file from its content.

Practise this

Reading one question is not practice. The trainer will draw a short set from objective 103 and space the ones you get wrong.

Practise LPIC-1 Exam 101-500

More questions on this objective

All questions on GNU and Unix commands

Practise LPIC-1 Exam 101-500