[BACK]Return to file.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / file

Annotation of src/usr.bin/file/file.1, Revision 1.37

1.37    ! nicm        1: .\" $OpenBSD: file.1,v 1.36 2015/04/24 16:24:11 nicm Exp $
1.8       aaron       2: .\" $FreeBSD: src/usr.bin/file/file.1,v 1.16 2000/03/01 12:19:39 sheldonh Exp $
1.18      jmc         3: .\"
1.36      nicm        4: .\" Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
1.19      ian         5: .\" Copyright (c) Ian F. Darwin 1986-1995.
                      6: .\" Software written by Ian F. Darwin and others;
                      7: .\" maintained 1995-present by Christos Zoulas and others.
1.20      jmc         8: .\"
1.19      ian         9: .\" Redistribution and use in source and binary forms, with or without
                     10: .\" modification, are permitted provided that the following conditions
                     11: .\" are met:
                     12: .\" 1. Redistributions of source code must retain the above copyright
                     13: .\"    notice immediately at the beginning of the file, without modification,
                     14: .\"    this list of conditions, and the following disclaimer.
                     15: .\" 2. Redistributions in binary form must reproduce the above copyright
                     16: .\"    notice, this list of conditions and the following disclaimer in the
                     17: .\"    documentation and/or other materials provided with the distribution.
1.20      jmc        18: .\"
1.19      ian        19: .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
                     20: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     21: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     22: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
                     23: .\" ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     24: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     25: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     26: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     27: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     28: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     29: .\" SUCH DAMAGE.
1.18      jmc        30: .\"
1.37    ! nicm       31: .Dd $Mdocdate: April 24 2015 $
1.8       aaron      32: .Dt FILE 1
                     33: .Os
                     34: .Sh NAME
                     35: .Nm file
                     36: .Nd determine file type
                     37: .Sh SYNOPSIS
1.30      ajacouto   38: .Nm
                     39: .Bk -words
1.36      nicm       40: .Op Fl bciLsW
                     41: .Ar
1.23      jaredy     42: .Ek
1.8       aaron      43: .Sh DESCRIPTION
1.22      jaredy     44: The
1.8       aaron      45: .Nm
1.36      nicm       46: utility tests each argument and attempts to determine its type.
                     47: Three sets of tests are performed:
                     48: .Bl -enum -offset Ds
                     49: .It
                     50: Filesystem tests, for example if a file is empty, or a special file such as a
                     51: socket or named pipe (FIFO).
                     52: .It
                     53: .Dq Magic
                     54: tests for data in particular fixed formats.
                     55: These are loaded from the
                     56: .Pa /etc/magic
                     57: file (or
                     58: .Pa ~/.magic
1.37    ! nicm       59: instead if it exists and
        !            60: .Nm
        !            61: is not running as root).
1.36      nicm       62: The file format is described in
                     63: .Xr magic 5 .
                     64: .It
                     65: Tests for text files such as plain ASCII or C programming language files.
                     66: .El
1.8       aaron      67: .Pp
1.36      nicm       68: The first test which succeeds causes the file type to be printed.
                     69: The type will often contain one of the words
1.30      ajacouto   70: .Em text
1.36      nicm       71: (contains only printing characters and is probably safe to read on an ASCII
                     72: terminal),
1.30      ajacouto   73: .Em executable
1.36      nicm       74: (the file contains a compiled executable program)
1.1       deraadt    75: or
1.30      ajacouto   76: .Em data
1.36      nicm       77: meaning anything else.
1.30      ajacouto   78: .Sh OPTIONS
                     79: .Bl -tag -width indent
1.36      nicm       80: .It Fl b
                     81: Do not prepend filenames to output lines.
                     82: .It Fl c
                     83: Print a summary of the parsed magic file, usually used for debugging.
                     84: .It Fl i , -mime , -mime-type
                     85: Causes the file command to output MIME type strings rather than the more
                     86: traditional human-readable ones.
1.30      ajacouto   87: Thus it may say
1.36      nicm       88: .Dq text/plain
1.30      ajacouto   89: rather than
                     90: .Dq ASCII text .
1.36      nicm       91: .It Fl L
                     92: Causes symlinks to be followed.
                     93: .It Fl s
                     94: Instructs
1.30      ajacouto   95: .Nm
1.36      nicm       96: to attempt to read all files, not only those which
1.23      jaredy     97: .Xr stat 2
                     98: reports are ordinary files.
1.36      nicm       99: .It Fl W
                    100: Display warnings when parsing the magic file or applying its tests.
                    101: Usually used for debugging.
1.8       aaron     102: .El
1.12      aaron     103: .Sh FILES
                    104: .Bl -tag -width /etc/magic -compact
                    105: .It Pa /etc/magic
1.36      nicm      106: default magic file
1.12      aaron     107: .El
1.32      jmc       108: .Sh EXIT STATUS
                    109: .Ex -std file
1.8       aaron     110: .Sh SEE ALSO
                    111: .Xr magic 5
1.36      nicm      112: .Sh AUTHORS
1.30      ajacouto  113: .Nm
1.36      nicm      114: commands have appeared in many previous versions of
                    115: .Ux .
                    116: This version was written by Nicholas Marriott for
                    117: .Ox 5.8
                    118: to replace the previous version originally written by Ian Darwin.
1.8       aaron     119: .Pp
1.36      nicm      120: There is a large number of contributors to the magic files; many are listed in
                    121: the source files.