Multiple choice technology operating systems

What command is used to determine a file's type or contents?

  1. file

  2. type

  3. which

  4. grep

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

The 'file' command determines a file's type by examining its contents (magic numbers and header bytes), not just the extension. It outputs descriptions like 'ASCII text', 'ELF executable', 'JPEG image', etc. The 'type' command is a shell builtin for displaying command types, 'which' locates commands, and 'grep' searches for text patterns.