While I'm reading file(1) I noticed this in the man page (emphasis mine):

When adding local definitions to /etc/magic, make sure to preserve these keywords. Users depend on knowing that all the readable files in a directory have the word “text” printed. Don't do as Berkeley did and change “shell commands text” to “shell script”.

What's the story behind this sentence? I guess Berkeley refers to BSD (Berkeley software distribution) but Google didn't give enough information about this.

Link to file(1) http://man7.org/linux/man-pages/man1/file.1.html

Some digging around shows that this statement was added 27 years ago link

Don't do as one computer vendor did \- change ``shell commands text''
to ``shell script''.

and later changed to current statement link

Don't do as Berkeley did \- change ``shell commands text''

2 Answers 2


People had been writing scripts (and possibly C programs) to run file on a file, capturing the output with $(file foobar) or popen(), and doing a string match check to see whether the output from file contained (or ended with) the word “text”.  Then the developers of the Berkeley Software Distribution (at the University of California, Berkeley) did as described and caused all those scripts and programs not to recognize shell script files as text files.


Apparently this happened between 4.2 and 4.3BSD -- compare http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/usr.bin/file.c and http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD/usr/src/usr.bin/file.c

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .