file
PURPOSE
Determines file type.
SYNOPSIS
file [ -c ] [ -f ffile ] [ -m mfile ] filename ...
DESCRIPTION
The file command reads its input files, performs a series
of tests on each one, and attempts to classify them by
their types. file then writes the file types to standard
output. If a file appears to be ASCII, file examines the
first 512 bytes and tries to determine its language. If
a file does not appear to be ASCII, file further attempts
to distinguish a binary data file from a text file that
contains extended characters. If file is an a.out file,
and the version number is greater than zero (see "ld"),
file displays the version stamp.
The file command uses the file /etc/magic to identify
files that have some sort of magic number, that is, any
file containing a numeric or string constant that indi-
cates its type. Comments at the beginning of /etc/magic
explain its format.
FLAGS
-c Checks the mfile (/etc/magic by default) for
format errors. This validation is not
normally done. File typing is not done under
this flag.
-f file Reads file for a list of files to examine.
-m mfile Specifies mfile as the magic file (/etc/magic
by default).
EXAMPLES
1. To display the type of information a file contains:
file myfile
This displays the file type of "myfile" (directory,
data, ASCII text, C-program source, archive, and so
forth).
2. To display the type of each file named in a list of
file names:
file -f filenames
This displays the type of each file with a name that
appears in "filenames". Each file name must appear
alone on a line.
To create "filenames":
ls >filenames
then edit "filenames" as desired.
FILES
/etc/magic File type database.
RELATED INFORMATION
"Overview of International Character Support" in Managing
the AIX Operating System.