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

1.40    ! nicm        1: .\" $OpenBSD: file.1,v 1.39 2015/04/24 20:57:51 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
1.39      nicm       39: .Op Fl bchiLsW
1.36      nicm       40: .Ar
1.8       aaron      41: .Sh DESCRIPTION
1.22      jaredy     42: The
1.8       aaron      43: .Nm
1.36      nicm       44: utility tests each argument and attempts to determine its type.
                     45: Three sets of tests are performed:
                     46: .Bl -enum -offset Ds
                     47: .It
                     48: Filesystem tests, for example if a file is empty, or a special file such as a
                     49: socket or named pipe (FIFO).
                     50: .It
                     51: .Dq Magic
                     52: tests for data in particular fixed formats.
                     53: These are loaded from the
                     54: .Pa /etc/magic
                     55: file (or
                     56: .Pa ~/.magic
1.37      nicm       57: instead if it exists and
                     58: .Nm
                     59: is not running as root).
1.36      nicm       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.38      jmc        76: .Pp
                     77: The options are as follows:
1.30      ajacouto   78: .Bl -tag -width indent
1.36      nicm       79: .It Fl b
1.39      nicm       80: Does not prepend filenames to output lines.
1.36      nicm       81: .It Fl c
1.39      nicm       82: Prints a summary of the parsed magic file; usually used for debugging.
                     83: .It Fl h
                     84: Causes symlinks not to be followed.
1.36      nicm       85: .It Fl i , -mime , -mime-type
                     86: Causes the file command to output MIME type strings rather than the more
                     87: traditional human-readable ones.
1.30      ajacouto   88: Thus it may say
1.36      nicm       89: .Dq text/plain
1.30      ajacouto   90: rather than
                     91: .Dq ASCII text .
1.36      nicm       92: .It Fl L
                     93: Causes symlinks to be followed.
                     94: .It Fl s
                     95: Instructs
1.30      ajacouto   96: .Nm
1.40    ! nicm       97: to attempt to read block and character device files, not only regular files.
1.36      nicm       98: .It Fl W
1.39      nicm       99: Displays warnings when parsing the magic file or applying its tests.
1.36      nicm      100: Usually used for debugging.
1.8       aaron     101: .El
1.12      aaron     102: .Sh FILES
                    103: .Bl -tag -width /etc/magic -compact
                    104: .It Pa /etc/magic
1.36      nicm      105: default magic file
1.12      aaron     106: .El
1.32      jmc       107: .Sh EXIT STATUS
                    108: .Ex -std file
1.8       aaron     109: .Sh SEE ALSO
                    110: .Xr magic 5
1.36      nicm      111: .Sh AUTHORS
1.38      jmc       112: .An -nosplit
1.30      ajacouto  113: .Nm
1.36      nicm      114: commands have appeared in many previous versions of
                    115: .Ux .
1.38      jmc       116: This version was written by
                    117: .An Nicholas Marriott
                    118: for
1.36      nicm      119: .Ox 5.8
1.38      jmc       120: to replace the previous version originally written by
                    121: .An Ian Darwin .
1.8       aaron     122: .Pp
1.36      nicm      123: There is a large number of contributors to the magic files; many are listed in
                    124: the source files.