Multiple choice technology operating systems

What command we can use to determine a file type?

  1. type filename

  2. file filename

  3. desc filename

  4. .filename

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The 'file' command examines file contents to determine and report the file type, unlike simple extensions. It works by analyzing magic numbers and file headers. Options A, C, and D are not valid Unix commands for file type detection.

AI explanation

The Unix/Linux file command inspects a file's contents (magic numbers, headers) and reports its type (e.g., 'ASCII text', 'ELF executable', 'JPEG image'), so file filename is correct. type filename is a shell builtin that reports whether a name is a command/alias/builtin, not a file's content type. desc and a bare .filename are not standard commands for this purpose.