In addition, when the so called sha-bang is present in the very first line of the script, the
file command tells you about the type of script/program:
Code:
$ file /etc/rc.d/rc
/etc/rc.d/rc: Bourne-Again shell script text executable
Basically on a Linux system you will find two types of executable files: shell scripts, being /bin/bash the native shell in Linux, and ELF executables. For example
Code:
$ file /usr/bin/file
/usr/bin/file: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
These are the compiled C/C++ programs. The source of these programs are not available by default on your system, unless you explicitly install the source packages (for example if you want to rebuild a package or re-compile a code using specific options).
Nevertheless you can find other types of scripts, basically written in Perl or Python. At a first glance the
file command can reveal their nature.