1file(1B)           SunOS/BSD Compatibility Package Commands           file(1B)
2
3
4

NAME

6       file - determine the type of a file by examining its contents
7

SYNOPSIS

9       /usr/ucb/file [-f ffile] [-cL] [-m mfile] filename...
10
11

DESCRIPTION

13       file  performs  a  series  of  tests on each  filename in an attempt to
14       determine what it contains. If the contents of  a  file  appear  to  be
15       ASCII  text,  file  examines the first 512 bytes and tries to guess its
16       language.
17
18
19       file uses the file /etc/magic to identify files that have some sort  of
20       magic number, that is, any file containing a numeric or string constant
21       that indicates its type.
22

OPTIONS

24       -c          Check for format errors in the magic number file. For  rea‐
25                   sons of efficiency, this validation is not normally carried
26                   out. No file type-checking is done under -c.
27
28
29       -f ffile    Get a list of filenames to identify from  ffile.
30
31
32       -L          If a file is a symbolic link, test the file the link refer‐
33                   ences rather than the link itself.
34
35
36       -m mfile    Use mfile as the name of an alternate magic number file.
37
38

EXAMPLES

40       Example 1 Using file on all the files in a specific user's directory.
41
42
43       This example illustrates the use of file on all the files in a specific
44       user's directory:
45
46
47         example% pwd
48         /usr/blort/misc
49
50
51
52         example% /usr/ucb/file  *
53
54         code:           mc68020 demand paged executable
55         code.c:         c program text
56         counts:         ascii text
57         doc:            roff,nroff, or eqn input text
58         empty.file:     empty
59         libz:           archive random library
60         memos:          directory
61         project:        symboliclink to /usr/project
62         script:         executable shell script
63         titles:         ascii text
64         s5.stuff:       cpio archive
65
66
67         example%
68
69
70

ENVIRONMENT VARIABLES

72       The environment variables LC_CTYPE, LANG, and  LC_default  control  the
73       character classification throughout file. On entry to file, these envi‐
74       ronment variables are checked in the following order:  LC_CTYPE,  LANG,
75       and  LC_default.  When  a  valid  value is found, remaining environment
76       variables for character classification are ignored. For example, a  new
77       setting  for LANG does not override the current valid character classi‐
78       fication rules of LC_CTYPE. When none of the values is valid, the shell
79       character classification defaults to the   POSIX.1 "C"  locale.
80

FILES

82       /etc/magic
83

ATTRIBUTES

85       See attributes(5) for descriptions of the following attributes:
86
87
88
89
90       ┌─────────────────────────────┬─────────────────────────────┐
91       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
92       ├─────────────────────────────┼─────────────────────────────┤
93       │Availability                 │SUNWscpu                     │
94       └─────────────────────────────┴─────────────────────────────┘
95

SEE ALSO

97       magic(4), attributes(5)
98

BUGS

100       file  often makes mistakes.  In particular, it often suggests that com‐
101       mand files are C programs.
102
103
104       file does not recognize Pascal or  LISP.
105
106
107
108SunOS 5.11                        14 Sep 1992                         file(1B)
Impressum