file

Displays the classification of a file

file [option] file-list

The file utility classifies files according to their contents.

Arguments

The file-list contains the pathnames of one or more files that file classifies. You can specify any kind of file, including ordinary, directory, and special files, in the file-list.

Option

-f file

file Takes the names of files to be examined from file rather than from the command line. The names of the files must be listed one per line in file.

-z

zip Attempts to classify files within a compressed file.

Notes

The file utility can classify more than 5000 file types. Some of the more common file types found on GNU/Linux systems, as displayed by file, are

 archive ascii text c program text commands text ...

Get A Practical Guide to Red Hat® Linux® 8 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.