What are the executables you daily use made of? Are they scripts or binaries?
What do developers use? Python? Java? Or perhaps Ruby?
It’s easy and funny to find it out, you just need a couple of bash lines with a pinch of awk:
#!/bin/bash
datafile=$(mktemp /tmp/bintypes.logXXX)
# scan /bin /sbin,/usr/bin,/usr/sbin
for file in /{,s}bin/* /usr/{,s}bin/*; do
rfile=$(readlink -f $file);
# file is a tool which tells what a file contains
[ -f $rfile ] && file "$rfile" >>"$datafile";
done
# count all occurrences with awk
# in some cases we have an 'a ' article in front of the description (e.g. "a python script text executable")
# we cut it away with sub()
awk -F "[:,]" '
{
sub(/ a /," ",$2);
a[$2]++
}
END{
for (el in a)
print a[el] "\t" el
}' "$datafile" | sort -n
rm "$datafile";
Here is my output:
1 ASCII English text
1 awk script text executable
1 /bin/loadkeys script text executable
2 setgid ELF 32-bit LSB shared object
4 /usr/bin/ruby1.8 script text executable
5 setuid setgid ELF 32-bit LSB executable
13 ELF 32-bit LSB shared object
14 setgid ELF 32-bit LSB executable
35 setuid ELF 32-bit LSB executable
61 Bourne-Again shell script text executable
119 python script text executable
225 perl script text executable
377 POSIX shell script text executable
1748 ELF 32-bit LSB executable
Hence, except for the binaries, the most common language used is Posix Shell scripting, followed by Perl and then Python. That lonely awk script is /usr/sbin/mksmbpasswd while the plain text file is just an error: it’s a shell script without the shebang (to whom it may concern, the file is /usr/bin/gnome-power-bugreport.sh). Do these results surprise you?
It must be said that of all the above tools, only 96 belong to Gnu coreutils, the others come from a really huge variety of programs (i.e. TeX, java, console.tools, etc.). In order to know which file belong to which package you have to modify the above script by using “dpkg -S $rfile” instead of file and change the field being counted by awk.
That’s all.