FILE(1-SysV) RISC/os Reference Manual FILE(1-SysV)
NAME
file - determine file type
SYNOPSIS
file [ -c ] [ -f ffile ] [ -m mfile ] filename...
DESCRIPTION
The file command tries to classify a file by doing a series
of tests. If a file seems to be ASCII, file examines the
first 512 bytes and tries to guess the language. If a file
is an executable a.out, file prints the version stamp, pro-
vided it is greater than 0 (see ld(1)).
This version of file differentiates between Berkeley
(4.2BSD) and MIPS objects and archives.
The file command recognizes when files have symbolic links
to other files. It lists these files as:
symbolic link to <type>
In the example, <type> shows the type of the file that the
symbolic link finally points to (file does distinguish sym-
bolic links to other symbolic links). If the symbolic link
points to nothing, file shows the <type> as "nonexistent
filename".
If the -f option is given, the next argument is assumed to
be a file that contains the names of the files to be exam-
ined.
file uses the file /etc/magic to identify files that have a
magic number, that is, any file containing a numeric or
string constant that shows its type. Commentary at the
beginning of /etc/magic explains the format.
The -m option instructs file to use an alternate magic file.
The -c flag causes file to check the magic file for format
errors. This validation is not normally done for effi-
ciency. No file typing is done under -c.
To change the file types that file recognizes, you need to
change the file command itself. The file command recognizes
these file types:
⊕ English text
⊕ PRESS files
⊕ RCS files
⊕ nroff/troff, tbl, or eqn input text
Printed 1/15/91 Page 1
FILE(1-SysV) RISC/os Reference Manual FILE(1-SysV)
⊕ ascii text
⊕ ascii text with garbage
⊕ MIPS assembler program text
⊕ block
⊕ C program text
⊕ character
⊕ commands text
⊕ data
⊕ directory
⊕ empty
⊕ executable script for <command>- this refers to
files beginning with #!<command>
⊕ fifo
⊕ Fortran program text
⊕ otroff output
⊕ sccs
⊕ socket
⊕ troff intermediate output text
The file command reads the /etc/magic file to describe files
that can be distinguished by fixed-position data. For exam-
ple, the first two bytes contain a specific number that dis-
tinguishes the file type. The etc/magic file contains these
types:
⊕ cpio archive
⊕ ASCII cpio archive
⊕ very old archive
⊕ old archive
⊕ apl workspace
⊕ packed data
Page 2 Printed 1/15/91
FILE(1-SysV) RISC/os Reference Manual FILE(1-SysV)
⊕ old portable archive
⊕ MMDF mailbox
⊕ executable
⊕ UNIX-rt ldp
⊕ old overlay
⊕ pure executable
⊕ separate I&D
⊕ demand-paged executable
⊕ obsolete text-overlay pure
⊕ obsolete text-overlay separate
⊕ text-overlay pure
⊕ text-overlay separate
⊕ PDP11 kernel overlay
⊕ executable
⊕ pure executable
⊕ BASIC-16 executable
⊕ BASIC-16 executable (TV)
⊕ x86 executable
⊕ x86 executable (TV)
⊕ MC68000 executable
⊕ MC68000 executable (TV)
⊕ 3B20 executable
⊕ 3B20 executable (TV)
⊕ 3B5|DMD executable
⊕ 3B5|DMD executable (TV)
⊕ mipseb
Printed 1/15/91 Page 3
FILE(1-SysV) RISC/os Reference Manual FILE(1-SysV)
⊕ mipsel
⊕ swapped mipseb
⊕ swapped mipsel
⊕ mipseb ucode
⊕ mipsel ucode
⊕ Berkeley archive random library
⊕ MIPS archive
⊕ archive
The last three files on this list have the same format,
except for the existence and name of the first archive ele-
ment.
SEE ALSO
ld(1).
magic(4) in the Programmer's Reference Manual.
Page 4 Printed 1/15/91