The command file can be used to determine the file type and its character encoding.
Examples
Display file type:
You can use the option -i to display mime type and encoding of the file:
You can also use the command file to display the file type of an executable binary file (display the OS information and the libraries the executable requires):