Linux Magazine: It's (Not) Magic
Mar 09, 2005, 13:00 (0 Talkback[s])
(Other stories by Jerry Peek)
"While some operating systems use file extensions like
.doc,.pdf, and .txt to associate files with applications, Linux
systems generally eschews extensions.( Some applications use
extensions by convention — C compilers, for instance, expect
source filenames to end with .c — but the kernel doesn't
enforce this.) Instead, Linux uses a system of magic numbers, where
the first few bytes of each executable file tell the kernel how to
"For example, there's no need to name a shell script foo.sh.
Plain foo is fine, because Linux figures out the rest( as you'll
see in a moment). Magic numbers are widely used on Linux, and not
just for executables. Magic numbers are used to identify many other
types of files, too..."