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

Draft — not checked yet. This question was written from the published exam objectives and cites the clause it comes from, but nobody has yet read it against that clause and signed for it.

It is kept out of search results and out of mock exams until they have. Read the source below before you take the answer as settled.

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 set from objective 103 and space the ones you get wrong.

Practise LPIC-1 Exam 101-500