You can check the file type by using the following command from your shell.
root@admin#file index.php
It will show the following output.
index.php: PHP script text
root@admin#file demo_scoredsep.pl
It will show the following output.
demo_scoredsep.pl: perl script text
The above commands mostly used while we are not sure about file format.