FILE(1,C) AIX Commands Reference FILE(1,C)
-------------------------------------------------------------------------------
file
PURPOSE
Determines file type.
SYNTAX
+- -m /etc/magic -+ +- -f file --+
file ---| |---| |---|
+--- -m mfile ----+ +--- file ---+
^ |
+--------+
+- -m /etc/magic -+
file -- -c --| |---|
+--- -m mfile ----+
DESCRIPTION
The file command reads its input files, performs a series of tests on each one,
and attempts to classify them by their types. The file command 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,
the file command 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
indicates its type. Comments at the beginning of /etc/magic explain its
format.
If the file given is a hidden directory, the file command selects the component
that corresponds to the machine type on which the file command is being
executed. If the file is an a.out file, file displays the machine type for
which the program was compiled.
FLAGS
-c by default (/etc/magic) 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).
Processed November 8, 1990 FILE(1,C) 1
FILE(1,C) AIX Commands Reference FILE(1,C)
EXAMPLES
1. To display the type of information a file contains:
file myfile
This command 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 file_names
This command displays the type of each file with a name that appears in
"file names". Each file name must appear alone on a line.
To create "file names":
ls -C1 > file_names
then edit "file names" as desired.
FILES
/etc/magic File type database.
RELATED INFORMATION
See the "Introduction to International Character Support" in Managing the AIX
Operating System.
Processed November 8, 1990 FILE(1,C) 2