The command “file” tells you the file type and format. It maintains loads of magics in its database to identify the type of a file.  If it can’t determine the file type, it will display whether it is an ASCII file or a binary file.

Here are few examples:

[neo@techpulp ~]# file /bin/bash
/bin/bash: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
[neo@techpulp ~]#
[neo@techpulp ~]# file Videos/Animals/leopard.flash
Videos/Animals/leopard.flash: Macromedia Flash Video
[neo@techpulp ~]#
[neo@techpulp ~]# file MyDocs.zip
MyDocs.zip: Zip archive data, at least v1.0 to extract
[neo@techpulp ~]# file mantis-1.1.6-1.fc10.noarch.rpm
mantis-1.1.6-1.fc10.noarch.rpm: RPM v3 bin mantis-1.1.6-1.fc10
[neo@techpulp ~]#