file


file

Purpose

Display the type of data in a file based on rules defined in the /usr/lib/magic file (this is known as the magic file).

Syntax

file [options] files

Options

-c displays a parsed form of a magic file (or the default one) and exits.

-m file1[:file2 : . . .] specifies other magic files.

-v displays the version number and exits.

-z looks inside compressed files.

Description

The file command uses rules specified in the /usr/lib/magic file to determine the type of data in the specified files. For example, you can use the file command to check the type of each file in the /usr/lib directory, as shown here:

file * | more 
alchemist:                          directory 
ao:                                 directory 
appletproxy.la:                     ASCII English text, with
                                      very long lines 
appletproxy.so:                     ELF 32-bit LSB shared  object, Intel 80386,  version 1 (SYSV),  stripped 
aspell:                             directory 
autofs:                             directory 
bash:                               directory 
bcc:                                directory 
bonobo:                             directory 
bonobo-2.0:                         directory 
bonobo_confConf.sh:                 ASCII English text, with
                                      very long lines 
bonoboConf.sh:                      ASCII English text, with
                                      very long lines 
bonoboxConf.sh:                     ASCII English text, with
                                      very long lines 
bonobox_printConf.sh:               ASCII English text, with
                                      very long lines 
cracklib_dict.hwm:
                  data cracklib_dict.pwd:
                  data cracklib_dict.pwi:
                  data 
(. . . lines deleted)