file - determine the type of a file by examining its con-
/usr/ucb/file [-f ffile] [-cL] [-m mfile] filename...
file performs a series of tests on each filename in an
attempt to determine what it contains. If the contents of a
file appear to be ASCII text, file examines the first 512
bytes and tries to guess its language.
file 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.
-c Check for format errors in the magic number file. For
reasons of efficiency, this validation is not normally
carried out. No file type-checking is done under -c.
Get a list of filenames to identify from ffile.
-L If a file is a symbolic link, test the file the link
references rather than the link itself.
Use mfile as the name of an alternate magic number
Example 1: Using file on all the files in a specific user's
This example illustrates the use of file on all the files in
a specific user's directory:
example% /usr/ucb/file *
code: mc68020 demand paged executable
code.c: c program text
counts: ascii text
doc: roff,nroff, or eqn input text
libz: archive random library
project: symboliclink to /usr/project
script: executable shell script
titles: ascii text
s5.stuff: cpio archive
The environment variables LC_CTYPE, LANG, and LC_default
control the character classification throughout file. On
entry to file, these environment variables are checked in
the following order: LC_CTYPE, LANG, and LC_default. When a
valid value is found, remaining environment variables for
character classification are ignored. For example, a new
setting for LANG does not override the current valid charac-
ter classification rules of LC_CTYPE. When none of the
values is valid, the shell character classification defaults
to the POSIX.1 "C" locale.
See attributes(5) for descriptions of the following attri-
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
| Availability | SUNWscpu |
file often makes mistakes. In particular, it often suggests
that command files are C programs.
file does not recognize Pascal or LISP.
Man(1) output converted with