detecting file types



Hi

I would like to know how to detect if a file is binary, if
it's an ascii or if it's a link to another file.
Unfortunately I don't know how to do that.
.