Wednesday, June 27, 2007

FIle command n Type command

File command
performs three sets of tests, performed in this order: filesystem tests, magic number tests, and language tests. The first test that succeeds causes the file type to be printed.

File system test : checks for "text" (the file contains only printing characters and a few common control characters and is probably safe to read on an ASCII terminal),

" executable" (the file contains the result of compiling a program in a form understandable to some UNIX kernel or another),
or "data" meaning anything else (data is usually `binary' or non-printable)


example
$file dirname
dirname:directory
$file a.out
a.out:ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU
$file examine.html
examine.html: HTML document text
$file view_this picture.gif
view_this: ASCII English text
picture.gif: GIF image data, version 89a, 88 x 31

No comments: