FILE(1) — USER COMMANDS
NAME
file − determine file type
SYNOPSIS
file [ −Lc ] [ −f ffile ] [ −m mfile ] filename ...
DESCRIPTION
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.
OPTIONS
−f Get a list of filenames to identify from ffile.
−m Use mfile as the name of an alternate magic number file.
−L If a file is a symbolic link, test the file the link references rather than the link itself.
−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.
EXAMPLE
The example illustrates the use of file on all the files in a specific user’s directory:
% pwd
/usr/blort/misc
% file ∗
code: mc68020 demand paged executable
code.c:c program text
counts: ascii text
doc:roff, nroff, or eqn input text
empty.file: empty
libz:archive random library
memos:directory
project:symbolic link to /usr/project
script:executable shell script
titles:ascii text
s5.stuff:cpio archive
%
SEE ALSO
BUGS
file often makes mistakes. In particular, it often suggests that command files are C programs.
Does not recognize Pascal or LISP.
Sun Release 3.2 — Last change: 29 April 1986