2 .\" Copyright (c) 1992, Sun Microsystems, Inc.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH FILE 1B "Sep 14, 1992"
8 file \- determine the type of a file by examining its contents
12 \fB/usr/ucb/file\fR [\fB-f\fR \fIffile\fR] [\fB-cL\fR] [\fB-m\fR \fImfile\fR] \fIfilename\fR...
18 \fBfile\fR performs a series of tests on each \fIfilename\fR in an attempt to
19 determine what it contains. If the contents of a file appear to be \fBASCII\fR
20 text, \fBfile\fR examines the first 512 bytes and tries to guess its language.
23 \fBfile\fR uses the file \fB/etc/magic\fR to identify files that have some sort
24 of \fImagic number\fR, that is, any file containing a numeric or string
25 constant that indicates its type.
33 Check for format errors in the magic number file. For reasons of efficiency,
34 this validation is not normally carried out. No file type-checking is done
41 \fB\fB-f\fR \fIffile\fR\fR
44 Get a list of filenames to identify from \fIffile.\fR
53 If a file is a symbolic link, test the file the link references rather than the
60 \fB\fB-m\fR\fI mfile\fR\fR
63 Use \fImfile\fR as the name of an alternate magic number file.
68 \fBExample 1 \fRUsing \fBfile\fR on all the files in a specific user's
72 This example illustrates the use of \fBfile\fR on all the files in a specific
87 example% \fB/usr/ucb/file *\fR
89 code: mc68020 demand paged executable
90 code.c: c program text
92 doc: roff,nroff, or eqn input text
94 libz: archive random library
96 project: symboliclink to /usr/project
97 script: executable shell script
99 s5.stuff: cpio archive
107 .SH ENVIRONMENT VARIABLES
110 The environment variables \fBLC_CTYPE\fR, \fBLANG\fR, and \fBLC_default\fR
111 control the character classification throughout \fBfile\fR. On entry to
112 \fBfile\fR, these environment variables are checked in the following order:
113 \fBLC_CTYPE\fR, \fBLANG\fR, and \fBLC_default\fR. When a valid value is found,
114 remaining environment variables for character classification are ignored. For
115 example, a new setting for \fBLANG\fR does not override the current valid
116 character classification rules of \fBLC_CTYPE\fR. When none of the values is
117 valid, the shell character classification defaults to the POSIX.1 "C"
126 \fBmagic\fR(4), \fBattributes\fR(5)
130 \fBfile\fR often makes mistakes. In particular, it often suggests that command
131 files are C programs.
134 \fBfile\fR does not recognize Pascal or LISP.