1 '\" te
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"
7 .SH NAME
8 file \- determine the type of a file by examining its contents
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fB/usr/ucb/file\fR [\fB-f\fR \fIffile\fR] [\fB-cL\fR] [\fB-m\fR \fImfile\fR] \fIfilename\fR...
13 .fi
14
15 .SH DESCRIPTION
16 .sp
17 .LP
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.
21 .sp
22 .LP
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.
26 .SH OPTIONS
27 .sp
28 .ne 2
29 .na
30 \fB\fB-c\fR\fR
31 .ad
32 .RS 12n
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
35 under \fB-c\fR.
36 .RE
37
38 .sp
39 .ne 2
40 .na
41 \fB\fB-f\fR \fIffile\fR\fR
42 .ad
43 .RS 12n
44 Get a list of filenames to identify from \fIffile.\fR
45 .RE
46
47 .sp
76 .in +2
77 .nf
78 example% \fBpwd
79 /usr/blort/misc\fR
80 .fi
81 .in -2
82 .sp
83
84 .sp
85 .in +2
86 .nf
87 example% \fB/usr/ucb/file *\fR
88
89 code: mc68020 demand paged executable
90 code.c: c program text
91 counts: ascii text
92 doc: roff,nroff, or eqn input text
93 empty.file: empty
94 libz: archive random library
95 memos: directory
96 project: symboliclink to /usr/project
97 script: executable shell script
98 titles: ascii text
99 s5.stuff: cpio archive
100
101
102 example%
103 .fi
104 .in -2
105 .sp
106
107 .SH ENVIRONMENT VARIABLES
108 .sp
109 .LP
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"
118 locale.
119 .SH FILES
120 .sp
121 .LP
122 \fB/etc/magic\fR
123 .SH SEE ALSO
124 .sp
125 .LP
126 \fBmagic\fR(4), \fBattributes\fR(5)
127 .SH BUGS
128 .sp
129 .LP
130 \fBfile\fR often makes mistakes. In particular, it often suggests that command
131 files are C programs.
132 .sp
133 .LP
134 \fBfile\fR does not recognize Pascal or LISP.
|
1 '\" te
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"
7 .SH NAME
8 file \- determine the type of a file by examining its contents
9 .SH SYNOPSIS
10 .LP
11 .nf
12 \fB/usr/ucb/file\fR [\fB-f\fR \fIffile\fR] [\fB-cL\fR] [\fB-m\fR \fImfile\fR] \fIfilename\fR...
13 .fi
14
15 .SH DESCRIPTION
16 .LP
17 \fBfile\fR performs a series of tests on each \fIfilename\fR in an attempt to
18 determine what it contains. If the contents of a file appear to be \fBASCII\fR
19 text, \fBfile\fR examines the first 512 bytes and tries to guess its language.
20 .sp
21 .LP
22 \fBfile\fR uses the file \fB/etc/magic\fR to identify files that have some sort
23 of \fImagic number\fR, that is, any file containing a numeric or string
24 constant that indicates its type.
25 .SH OPTIONS
26 .ne 2
27 .na
28 \fB\fB-c\fR\fR
29 .ad
30 .RS 12n
31 Check for format errors in the magic number file. For reasons of efficiency,
32 this validation is not normally carried out. No file type-checking is done
33 under \fB-c\fR.
34 .RE
35
36 .sp
37 .ne 2
38 .na
39 \fB\fB-f\fR \fIffile\fR\fR
40 .ad
41 .RS 12n
42 Get a list of filenames to identify from \fIffile.\fR
43 .RE
44
45 .sp
74 .in +2
75 .nf
76 example% \fBpwd
77 /usr/blort/misc\fR
78 .fi
79 .in -2
80 .sp
81
82 .sp
83 .in +2
84 .nf
85 example% \fB/usr/ucb/file *\fR
86
87 code: mc68020 demand paged executable
88 code.c: c program text
89 counts: ascii text
90 doc: roff,nroff, or eqn input text
91 empty.file: empty
92 libz: archive random library
93 memos: directory
94 project: symbolic link to /usr/project
95 script: executable shell script
96 titles: ascii text
97 s5.stuff: cpio archive
98
99
100 example%
101 .fi
102 .in -2
103 .sp
104
105 .SH ENVIRONMENT VARIABLES
106 .LP
107 The environment variables \fBLC_CTYPE\fR, \fBLANG\fR, and \fBLC_default\fR
108 control the character classification throughout \fBfile\fR. On entry to
109 \fBfile\fR, these environment variables are checked in the following order:
110 \fBLC_CTYPE\fR, \fBLANG\fR, and \fBLC_default\fR. When a valid value is found,
111 remaining environment variables for character classification are ignored. For
112 example, a new setting for \fBLANG\fR does not override the current valid
113 character classification rules of \fBLC_CTYPE\fR. When none of the values is
114 valid, the shell character classification defaults to the POSIX.1 "C"
115 locale.
116 .SH FILES
117 .LP
118 \fB/etc/magic\fR
119 .SH SEE ALSO
120 .LP
121 \fBmagic\fR(4), \fBattributes\fR(5)
122 .SH BUGS
123 .LP
124 \fBfile\fR often makes mistakes. In particular, it often suggests that command
125 files are C programs.
126 .sp
127 .LP
128 \fBfile\fR does not recognize Pascal or LISP.
|