File and Folder Operations

file

Identifies a file's type from its contents.

file guesses what a file is by inspecting magic bytes and other content hints rather than trusting the filename extension.

Syntax
file [options] file...

Arguments explained

  • file is one or more paths to identify.
  • -b omits the filename in output.
  • -i prints MIME-style information.

Common examples

Identify a download
file archive

Reports whether archive is text, compressed data, an executable, an image, or another type.

Show MIME type
file -i image.png

Prints MIME information useful for scripts.

file Command
FieldDetails
Commandfile
CategoryFile and Folder Operations
Primary useIdentifies a file's type from its contents.
Syntaxfile [options] file...