FILE(1) COMMAND REFERENCE FILE(1)
NAME
file - determine file type
SYNOPSIS
file [ -c ] [ -f ffile ] [ -m mfile ] arg ...
DESCRIPTION
File performs a series of tests on each argument in an
attempt to classify it. If an argument appears to be ASCII,
file examines the first 512 bytes and tries to guess its
language.
Each file is printed in the format:
name: file type Symbolic links are printed in
the format:
name: Symbolic link. File pointed to is <file
type>
File uses the file /usr/lib/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. The
file format is described in the manual page magic(5).
File recognizes the following file types:
ASCII archives Empty
ASCII text English text
Assembler program text FORTRAN program text
BASIC program text MH message
Block special News article
C program text Nroff, troff, tbl, or eqn input
Character special Old archive
Commands text Old executable
Compacted text Packed text
Cpio archives Program scripts
Data RCS file
Demand paged pure executable Read only executable
Directories Troff output
If the file is executable and not stripped, that fact is
noted.
There are two ASCII archive formats: normal and long. In
each case, if the archive contains a symbol definition table
(see ar(1) and ranlib(1)), that fact is noted.
A program script file is a file whose first line is an
interpreter line (see execve(2)). The name of the program to
be executed is printed.
Printed 10/17/86 1
FILE(1) COMMAND REFERENCE FILE(1)
If an ASC.B file contains characters with the eighth bit
set, the file type is followed by the words ``with
garbage''.
OPTIONS
-c Causes file to check the magic file for format errors.
This validation is not normally carried out for reasons
of efficiency. No file typing is done under -c.
-fffile
The next argument is taken to be a file containing the
names of the files to be examined.
-mmfile
Instructs file to use an alternate magic file.
EXAMPLES
The following example will print the name of each file in
/da/tmp followed by its classification.
file /da/tmp/*
RETURN VALUE
[P_ERR] A system error occurred. Execution
terminated. See intro(2) for more
information on system errors.
[NP_ERR] An error occurred that was not a system
error. Execution terminated.
[NP_WARN] An error warranting a warning message
occurred. Execution continues.
[USAGE] Incorrect command line syntax. Execution
terminated.
[NO_ERRS] Command completed without error.
CAVEATS
It often makes mistakes. In particular it often suggests
that command files are C programs.
Does not recognize Pascal or LISP.
Interpreter lines ('#! pathname) are not checked for
validity. A line like '#! /foo' will cause the file to be
identified as script commands for /foo, even though the file
will not be executed. Execute permission is not checked.
Printed 10/17/86 2
FILE(1) COMMAND REFERENCE FILE(1)
SEE ALSO
ld(1), notmagic(3c), a.out(5), ar(5), cpio(5), magic(5),
rcsfile(5rcs).
Printed 10/17/86 3
%%index%%
na:72,62;
sy:134,195;
de:329,2122;2595,135;
op:2730,546;
ex:3276,205;
rv:3481,621;
ca:4102,463;
se:4709,268;
%%index%%000000000142