Print this page
4732 /usr/bin/file should provide -b option for compatiblity with GNU/BSD file
Reviewed by: Andy Stormont <andyjstormont@gmail.com>
Reviewed by: Serghei Samsi <sscdvp@gmail.com>
Reviewed by: Alexander Pyhalov <alp@rsu.ru>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/man/man1/file.1
+++ new/usr/src/man/man1/file.1
1 1 '\" te
2 2 .\" Copyright 1989 AT&T Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved
3 3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
4 4 .\" http://www.opengroup.org/bookstore/.
5 5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
6 6 .\" This notice shall appear on any product containing this material.
7 7 .\" 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.
8 8 .\" 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.
9 9 .\" 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]
10 -.TH FILE 1 "Sep 10, 2013"
10 +.TH FILE 1 "Apr 11, 2014"
11 11 .SH NAME
12 12 file \- determine file type
13 13 .SH SYNOPSIS
14 14 .LP
15 15 .nf
16 -\fB/usr/bin/file\fR [\fB-dh\fR] [\fB-m\fR \fImfile\fR] [\fB-M\fR \fIMfile\fR] [\fB-f\fR \fIffile\fR] \fIfile\fR...
16 +\fB/usr/bin/file\fR [\fB-bdh\fR] [\fB-m\fR \fImfile\fR] [\fB-M\fR \fIMfile\fR] [\fB-f\fR \fIffile\fR] \fIfile\fR...
17 17 .fi
18 18
19 19 .LP
20 20 .nf
21 -\fB/usr/bin/file\fR [\fB-dh\fR] [\fB-m\fR \fImfile\fR] [\fB-M\fR \fIMfile\fR] \fB-f\fR \fIffile\fR
21 +\fB/usr/bin/file\fR [\fB-bdh\fR] [\fB-m\fR \fImfile\fR] [\fB-M\fR \fIMfile\fR] \fB-f\fR \fIffile\fR
22 22 .fi
23 23
24 24 .LP
25 25 .nf
26 -\fB/usr/bin/file\fR \fB-i\fR [\fB-h\fR] [\fB-f\fR \fIffile\fR] \fIfile\fR...
26 +\fB/usr/bin/file\fR \fB-i\fR [\fB-bh\fR] [\fB-f\fR \fIffile\fR] \fIfile\fR...
27 27 .fi
28 28
29 29 .LP
30 30 .nf
31 -\fB/usr/bin/file\fR \fB-i\fR [\fB-h\fR] \fB-f\fR \fIffile\fR
31 +\fB/usr/bin/file\fR \fB-i\fR [\fB-bh\fR] \fB-f\fR \fIffile\fR
32 32 .fi
33 33
34 34 .LP
35 35 .nf
36 36 \fB/usr/bin/file\fR \fB-c\fR [\fB-d\fR] [\fB-m\fR \fImfile\fR] [\fB-M\fR \fIMfile\fR]
37 37 .fi
38 38
39 39 .LP
40 40 .nf
41 -\fB/usr/xpg4/bin/file\fR [\fB-dh\fR] [\fB-m\fR \fImfile\fR] [\fB-M\fR \fIMfile\fR] [\fB-f\fR \fIffile\fR] \fIfile\fR...
41 +\fB/usr/xpg4/bin/file\fR [\fB-bdh\fR] [\fB-m\fR \fImfile\fR] [\fB-M\fR \fIMfile\fR] [\fB-f\fR \fIffile\fR] \fIfile\fR...
42 42 .fi
43 43
44 44 .LP
45 45 .nf
46 -\fB/usr/xpg4/bin/file\fR [\fB-dh\fR] [\fB-m\fR \fImfile\fR] [\fB-M\fR \fIMfile\fR] \fB-f\fR \fIffile\fR
46 +\fB/usr/xpg4/bin/file\fR [\fB-bdh\fR] [\fB-m\fR \fImfile\fR] [\fB-M\fR \fIMfile\fR] \fB-f\fR \fIffile\fR
47 47 .fi
48 48
49 49 .LP
50 50 .nf
51 -\fB/usr/xpg4/bin/file\fR \fB-i\fR [\fB-h\fR] [\fB-f\fR \fIffile\fR] \fIfile\fR...
51 +\fB/usr/xpg4/bin/file\fR \fB-i\fR [\fB-bh\fR] [\fB-f\fR \fIffile\fR] \fIfile\fR...
52 52 .fi
53 53
54 54 .LP
55 55 .nf
56 -\fB/usr/xpg4/bin/file\fR \fB-i\fR [\fB-h\fR] \fB-f\fR \fIffile\fR
56 +\fB/usr/xpg4/bin/file\fR \fB-i\fR [\fB-bh\fR] \fB-f\fR \fIffile\fR
57 57 .fi
58 58
59 59 .LP
60 60 .nf
61 61 \fB/usr/xpg4/bin/file\fR \fB-c\fR [\fB-d\fR] [\fB-m\fR \fImfile\fR] [\fB-M\fR \fIMfile\fR]
62 62 .fi
63 63
64 64 .SH DESCRIPTION
65 65 .sp
66 66 .LP
67 67 The \fBfile\fR utility performs a series of tests on each file supplied by
68 68 \fIfile\fR and, optionally, on each file listed in \fIffile\fR in an attempt to
69 69 classify it. If the file is not a regular file, its file type is identified.
70 70 The file types directory, \fBFIFO\fR, block special, and character special are
71 71 identified as such. If the file is a regular file and the file is zero-length,
72 72 it is identified as an empty file.
73 73 .sp
74 74 .LP
75 75 If \fIfile\fR appears to be a text file, \fBfile\fR examines the first 512
76 76 bytes and tries to determine its programming language. If \fIfile\fR is a
77 77 symbolic link, by default the link is followed and \fBfile\fR tests the file to
78 78 which the symbolic link refers.
79 79 .sp
80 80 .LP
81 81 If \fIfile\fR is a relocatable object, executable, or shared object, \fBfile\fR
82 82 prints out information about the file's execution requirements. This
83 83 information includes the machine class, byte-ordering, static/dynamic linkage,
84 84 and any software or hardware capability requirements. If \fIfile\fR is a
85 85 runtime linking configuration file, \fBfile\fR prints information about the
86 86 target platform, including the machine class and byte-ordering.
87 87 .sp
88 88 .LP
89 89 By default, \fBfile\fR will try to use the localized magic file
90 90 \fB/usr/lib/locale/\fIlocale\fR/LC_MESSAGES/magic\fR, if it exists, to identify
91 91 files that have a magic number. For example, in the Japanese locale, \fBfile\fR
92 92 will try to use \fB/usr/lib/locale/ja/LC_MESSAGES/magic\fR. If a localized
93 93 magic file does not exist, \fBfile\fR will utilize \fB/etc/magic\fR. A magic
94 94 number is a numeric or string constant that indicates the file type. See
95 95 \fBmagic\fR(4) for an explanation of the format of \fB/etc/magic\fR.
96 96 .sp
97 97 .LP
98 98 If \fIfile\fR does not exist, cannot be read, or its file status could not be
↓ open down ↓ |
32 lines elided |
↑ open up ↑ |
99 99 determined, it is not considered an error that affects the exit status. The
100 100 output will indicate that the file was processed, but that its type could not
101 101 be determined.
102 102 .SH OPTIONS
103 103 .sp
104 104 .LP
105 105 The following options are supported:
106 106 .sp
107 107 .ne 2
108 108 .na
109 +\fB\fB-b\fR\fR
110 +.ad
111 +.RS 12n
112 +Be brief, do not print leading filename.
113 +.RE
114 +
115 +.sp
116 +.ne 2
117 +.na
109 118 \fB\fB-c\fR\fR
110 119 .ad
111 120 .RS 12n
112 121 Checks the magic file for format errors. For reasons of efficiency, this
113 122 validation is normally not carried out.
114 123 .RE
115 124
116 125 .sp
117 126 .ne 2
118 127 .na
119 128 \fB\fB-d\fR\fR
120 129 .ad
121 130 .RS 12n
122 131 Applies any position-sensitive and context-sensitive default system tests to
123 132 the file.
124 133 .RE
125 134
126 135 .sp
127 136 .ne 2
128 137 .na
129 138 \fB\fB-f\fR \fIffile\fR\fR
130 139 .ad
131 140 .RS 12n
132 141 \fIffile\fR contains a list of the files to be examined.
133 142 .RE
134 143
135 144 .sp
136 145 .ne 2
137 146 .na
138 147 \fB\fB-h\fR\fR
139 148 .ad
140 149 .RS 12n
141 150 When a symbolic link is encountered, this option identifies the file as a
142 151 symbolic link. If \fB-h\fR is not specified and \fIfile\fR is a symbolic link
143 152 that refers to a non-existent file, the \fBfile\fR utility identifies the file
144 153 as a symbolic link, as if \fB-h\fR had been specified.
145 154 .RE
146 155
147 156 .sp
148 157 .ne 2
149 158 .na
150 159 \fB\fB-i\fR\fR
151 160 .ad
152 161 .RS 12n
153 162 If a file is a regular file, this option does not attempt to classify the type
154 163 of file further, but identifies the file as a "regular file".
155 164 .RE
156 165
157 166 .sp
158 167 .ne 2
159 168 .na
160 169 \fB\fB-m\fR \fImfile\fR\fR
161 170 .ad
162 171 .RS 12n
163 172 .sp
164 173 .ne 2
165 174 .na
166 175 \fB\fB/usr/bin/file\fR\fR
167 176 .ad
168 177 .RS 22n
169 178 Uses \fImfile\fR as an alternate magic file, instead of \fB/etc/magic\fR.
170 179 .RE
171 180
172 181 .sp
173 182 .ne 2
174 183 .na
175 184 \fB\fB/usr/xpg4/bin/file\fR\fR
176 185 .ad
177 186 .RS 22n
178 187 Specifies the name of a file containing position-sensitive tests that are
179 188 applied to a file in order to classify it (see \fBmagic\fR(4)). If the \fB-m\fR
180 189 option is specified without specifying the \fB-d\fR option or the \fB-M\fR
181 190 option, position-sensitive default system tests are applied after the
182 191 position-sensitive tests specified by the \fB-m\fR option.
183 192 .RE
184 193
185 194 .RE
186 195
187 196 .sp
188 197 .ne 2
189 198 .na
190 199 \fB\fB-M\fR \fIMfile\fR\fR
191 200 .ad
192 201 .RS 12n
193 202 Specifies the name of a file containing position-sensitive tests that are
194 203 applied to a file in order to classify it (see \fBmagic\fR(4)). No
195 204 position-sensitive default system tests nor context-sensitive default system
196 205 tests are applied unless the \fB-d\fR option is also specified.
197 206 .RE
198 207
199 208 .sp
200 209 .LP
201 210 If the \fB-M\fR option is specified with the \fB-d\fR option, the \fB-m\fR
202 211 option, or both, or if the \fB-m\fR option is specified with the \fB-d\fR
203 212 option, the concatenation of the position-sensitive tests specified by these
204 213 options is applied in the order specified by the appearance of these options.
205 214 .SH OPERANDS
206 215 .sp
207 216 .LP
208 217 The following operands are supported:
209 218 .sp
210 219 .ne 2
211 220 .na
212 221 \fB\fIfile\fR\fR
213 222 .ad
214 223 .RS 8n
215 224 A path name of a file to be tested.
216 225 .RE
217 226
218 227 .SH USAGE
219 228 .sp
220 229 .LP
221 230 See \fBlargefile\fR(5) for the description of the behavior of \fBfile\fR when
222 231 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
223 232 .SH EXAMPLES
224 233 .LP
225 234 \fBExample 1 \fRDetermining if an Argument is a Binary Executable Files
226 235 .sp
227 236 .LP
228 237 The following example determine if an argument is a binary executable file:
229 238
230 239 .sp
231 240 .in +2
232 241 .nf
233 242 file "$1" | grep \(miFq executable &&
234 243 printf "%s is executable.\en" "$1"
235 244 .fi
236 245 .in -2
237 246 .sp
238 247
239 248 .SH ENVIRONMENT VARIABLES
240 249 .sp
241 250 .LP
242 251 See \fBenviron\fR(5) for descriptions of the following environment variables
243 252 that affect the execution of \fBfile\fR: \fBLANG\fR, \fBLC_ALL\fR,
244 253 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
245 254 .SH EXIT STATUS
246 255 .sp
247 256 .LP
248 257 The following exit values are returned:
249 258 .sp
250 259 .ne 2
251 260 .na
252 261 \fB\fB0\fR\fR
253 262 .ad
254 263 .RS 6n
255 264 Successful completion.
256 265 .RE
257 266
258 267 .sp
259 268 .ne 2
260 269 .na
261 270 \fB\fB>0\fR\fR
262 271 .ad
263 272 .RS 6n
264 273 An error occurred.
265 274 .RE
266 275
267 276 .SH FILES
268 277 .sp
269 278 .ne 2
270 279 .na
271 280 \fB\fB/etc/magic\fR\fR
272 281 .ad
273 282 .RS 14n
274 283 \fBfile\fR's magic number file
275 284 .RE
276 285
277 286 .SH ATTRIBUTES
278 287 .sp
279 288 .LP
280 289 See \fBattributes\fR(5) for descriptions of the following attributes:
281 290 .sp
282 291
283 292 .sp
284 293 .TS
285 294 box;
286 295 c | c
287 296 l | l .
288 297 ATTRIBUTE TYPE ATTRIBUTE VALUE
289 298 _
290 299 CSI Enabled
291 300 _
292 301 Interface Stability Standard
293 302 .TE
294 303
295 304 .SH SEE ALSO
296 305 .sp
297 306 .LP
298 307 \fBcrle\fR(1), \fBelfdump\fR(1), \fBls\fR(1), \fBmagic\fR(4),
299 308 \fBattributes\fR(5), \fBenviron\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5)
↓ open down ↓ |
181 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX