1 FILE(1B)              BSD Compatibility Package Commands              FILE(1B)
   2 
   3 
   4 
   5 NAME
   6        file - determine the type of a file by examining its contents
   7 
   8 SYNOPSIS
   9        /usr/ucb/file [-f ffile] [-cL] [-m mfile] filename...
  10 
  11 
  12 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 
  23 OPTIONS
  24        -c
  25                    Check for format errors in the magic number file. For
  26                    reasons of efficiency, this validation is not normally
  27                    carried out. No file type-checking is done under -c.
  28 
  29 
  30        -f ffile
  31                    Get a list of filenames to identify from  ffile.
  32 
  33 
  34        -L
  35                    If a file is a symbolic link, test the file the link
  36                    references rather than the link itself.
  37 
  38 
  39        -m mfile
  40                    Use mfile as the name of an alternate magic number file.
  41 
  42 
  43 EXAMPLES
  44        Example 1 Using file on all the files in a specific user's directory.
  45 
  46 
  47        This example illustrates the use of file on all the files in a specific
  48        user's directory:
  49 
  50 
  51          example% pwd
  52          /usr/blort/misc
  53 
  54 
  55 
  56          example% /usr/ucb/file  *
  57 
  58          code:           mc68020 demand paged executable
  59          code.c:         c program text
  60          counts:         ascii text
  61          doc:            roff,nroff, or eqn input text
  62          empty.file:     empty
  63          libz:           archive random library
  64          memos:          directory
  65          project:        symbolic link to /usr/project
  66          script:         executable shell script
  67          titles:         ascii text
  68          s5.stuff:       cpio archive
  69 
  70 
  71          example%
  72 
  73 
  74 
  75 ENVIRONMENT VARIABLES
  76        The environment variables LC_CTYPE, LANG, and LC_default control the
  77        character classification throughout file. On entry to file, these
  78        environment variables are checked in the following order: LC_CTYPE,
  79        LANG, and LC_default. When a valid value is found, remaining
  80        environment variables for character classification are ignored. For
  81        example, a new setting for LANG does not override the current valid
  82        character classification rules of LC_CTYPE. When none of the values is
  83        valid, the shell character classification defaults to the   POSIX.1 "C"
  84        locale.
  85 
  86 FILES
  87        /etc/magic
  88 
  89 SEE ALSO
  90        magic(4), attributes(5)
  91 
  92 BUGS
  93        file often makes mistakes.  In particular, it often suggests that
  94        command files are C programs.
  95 
  96 
  97        file does not recognize Pascal or  LISP.
  98 
  99 
 100 
 101                               September 14, 1992                      FILE(1B)