Manual Page Result
0
Command: file | Section: 1 | Source: OpenBSD | File: file.1
FILE(1) FreeBSD General Commands Manual FILE(1)
NAME
file - determine file type
SYNOPSIS
file [-bchiLsW] file ...
DESCRIPTION
The file utility tests each argument and attempts to determine its type.
Three sets of tests are performed:
1. Filesystem tests, for example if a file is empty, or a special
file such as a socket or named pipe (FIFO).
2. "Magic" tests for data in particular fixed formats. These are
loaded from the /etc/magic file (or ~/.magic instead if it
exists and file is not running as root). The file format is
described in magic(5).
3. Tests for text files such as plain ASCII or C programming
language files.
The first test which succeeds causes the file type to be printed. The
type will often contain one of the words text (contains only printing
characters and is probably safe to read on an ASCII terminal), executable
(the file contains a compiled executable program) or data meaning
anything else.
If file is a single dash (`-'), file reads from the standard input.
The options are as follows:
-b, --brief
Does not prepend filenames to output lines.
-c Prints a summary of the parsed magic file; usually used for
debugging.
-h Causes symlinks not to be followed. This is the default.
-i, --mime, --mime-type
Outputs MIME type strings rather than the more traditional human-
readable ones. Thus it may say "text/plain" rather than "ASCII
text".
-L, --dereference
Causes symlinks to be followed.
-s Attempts to read block and character device files, not just
regular files.
-W Displays warnings when parsing the magic file or applying its
tests. Usually used for debugging.
FILES
/etc/magic default magic file
EXIT STATUS
The file utility exits 0 on success, and >0 if an error occurs.
SEE ALSO
magic(5)
AUTHORS
file commands have appeared in many previous versions of UNIX. This
version was written by Nicholas Marriott for OpenBSD 5.8 to replace the
previous version originally written by Ian Darwin.
There is a large number of contributors to the magic files; many are
listed in the source files.
FreeBSD 14.1-RELEASE-p8 December 24, 2015 FreeBSD 14.1-RELEASE-p8