Name
file — stdin stdout - file -- opt --help --version
Synopsis
file [options
]files
The file
command reports the
type of a file:
➜ file /etc/hosts /usr/bin/who letter.doc
/etc/hosts: ASCII English text
/usr/bin/who: Mach-O universal binary ...
letter.doc: CDF V2 Document, Little Endian, Os: MacOS ...
The reported file types are not always accurate; the file
program has its roots in older
operating systems that don’t track true file types the way the
Macintosh does. The output is an educated guess based on file content
and other factors.
Useful options
| Omit filenames (left column of output). |
| Print MIME types for the file, such as “text/plain” or “audio/mpeg,” instead of the usual output. |
| Read filenames, one per
line, from the given |
| Follow symbolic links, reporting the type of the destination file instead of the link. |
| If a file is compressed (see File Compression and Packaging), examine the uncompressed contents to decide the file type, instead of reporting “compressed data.” |
Get Macintosh Terminal Pocket Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.