file - Determine file type

Synopsis

file [-m MagicFile] [-f ListFile] [ file ... ]

file [-c] [-m MagicFile]

Description

In the first synopsis form, the file utility determines the type of object for the specified file. The file utility will make a best guess determination of the type. The file type is then written to standard output. If the pathname is determined to be a regular file, file examines the first 1024 bytes to determine the type. By default, the file utility uses the /etc/magic file to help identify files that have defined patterns at specified byte offsets within the object.

In the second synopsis form, the file utility checks the specified MagicFile for format errors.

Options

-c
Checks a specified magic file for format errors.
-f ListFile
Specifies a file containing a list of file names to be tested. This ListFile must have only one file per line and not contain leading or trailing spaces.
-m MagicFile
Specifies the name of the magic file to use. The default magic file is /etc/magic.

Operands

Each file is a pathname of a file to be tested.

Exit Status

Related information