UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: fgrepChapter 2
Unix Commands
Next: Reference: find


file [options] files

Classify the named files according to the type of data they contain. file checks the magic file (usually /etc/magic) to identify many common file types.



Check the format of the magic file (files argument is invalid with -c).


Run file on the filenames in list.


Do not follow symbolic links.


Use file as the magic file instead of /etc/magic.

Many file types are understood. Output lists each filename, followed by a brief classification such as:

ascii text
c program text
c-shell commands
iAPX 386 executable
[nt]roff, tbl, or eqn input text
shell commands
symbolic link to ../usr/etc/arp


List all files that are deemed to be nroff/troff input:

file * | grep roff

Previous: Reference: fgrepUNIX in a Nutshell: System V EditionNext: Reference: find
Reference: fgrepBook IndexReference: find

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System