[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.36

1.36    ! nicm        1: .\" $OpenBSD: file.1,v 1.35 2015/02/15 22:26:45 bentley 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.36    ! nicm       31: .Dd $Mdocdate: February 15 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
        !            59: instead if it exists).
        !            60: The file format is described in
        !            61: .Xr magic 5 .
        !            62: .It
        !            63: Tests for text files such as plain ASCII or C programming language files.
        !            64: .El
1.8       aaron      65: .Pp
1.36    ! nicm       66: The first test which succeeds causes the file type to be printed.
        !            67: The type will often contain one of the words
1.30      ajacouto   68: .Em text
1.36    ! nicm       69: (contains only printing characters and is probably safe to read on an ASCII
        !            70: terminal),
1.30      ajacouto   71: .Em executable
1.36    ! nicm       72: (the file contains a compiled executable program)
1.1       deraadt    73: or
1.30      ajacouto   74: .Em data
1.36    ! nicm       75: meaning anything else.
1.30      ajacouto   76: .Sh OPTIONS
                     77: .Bl -tag -width indent
1.36    ! nicm       78: .It Fl b
        !            79: Do not prepend filenames to output lines.
        !            80: .It Fl c
        !            81: Print a summary of the parsed magic file, usually used for debugging.
        !            82: .It Fl i , -mime , -mime-type
        !            83: Causes the file command to output MIME type strings rather than the more
        !            84: traditional human-readable ones.
1.30      ajacouto   85: Thus it may say
1.36    ! nicm       86: .Dq text/plain
1.30      ajacouto   87: rather than
                     88: .Dq ASCII text .
1.36    ! nicm       89: .It Fl L
        !            90: Causes symlinks to be followed.
        !            91: .It Fl s
        !            92: Instructs
1.30      ajacouto   93: .Nm
1.36    ! nicm       94: to attempt to read all files, not only those which
1.23      jaredy     95: .Xr stat 2
                     96: reports are ordinary files.
1.36    ! nicm       97: .It Fl W
        !            98: Display warnings when parsing the magic file or applying its tests.
        !            99: Usually used for debugging.
1.8       aaron     100: .El
1.12      aaron     101: .Sh FILES
                    102: .Bl -tag -width /etc/magic -compact
                    103: .It Pa /etc/magic
1.36    ! nicm      104: default magic file
1.12      aaron     105: .El
1.32      jmc       106: .Sh EXIT STATUS
                    107: .Ex -std file
1.8       aaron     108: .Sh SEE ALSO
                    109: .Xr magic 5
1.36    ! nicm      110: .Sh AUTHORS
1.30      ajacouto  111: .Nm
1.36    ! nicm      112: commands have appeared in many previous versions of
        !           113: .Ux .
        !           114: This version was written by Nicholas Marriott for
        !           115: .Ox 5.8
        !           116: to replace the previous version originally written by Ian Darwin.
1.8       aaron     117: .Pp
1.36    ! nicm      118: There is a large number of contributors to the magic files; many are listed in
        !           119: the source files.