file command

 

 


原理

 

file 會根據 magic.mgc ( /usr/share/misc/magic.mgc ) 的 patten 去判斷一個 file 的 format

magic.mgc  係 compiled 的 magic ( /usr/share/misc/magic )

Example

file hfs.exe

hfs.exe: PE32 executable for MS Windows (GUI) Intel 80386 32-bit

# Output mime type strings rather than the more traditional human readable ones.

file -i hfs.exe

hfs.exe: application/octet-stream; charset=binary