Name
file [options
] files
— file
Synopsis
/usr/bin
stdin stdout - file -- opt --help --version
The file
command reports the type of a file:
$ file /etc/hosts /usr/bin/who letter.doc /etc/hosts: ASCII text /usr/bin/who: ELF 32-bit LSB executable, Intel 80386 ... letter.doc: Microsoft Office Document
Unlike some other operating systems, Linux does not keep track of file types, so the output is an educated guess based on the 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 Linux 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.