Is the bin/ directory for storing binary files

binarydirectory-structureexecutablescripting

I have seen many tutorials saying that the bin directory is used to store binary files, meaning there is only 0 and 1 in the files in that directory.

However, in many cases, I see files in bin that are not only 0 and 1.

For example, the django-admin.py under the xx/bin/ directory:

#!/usr/bin/env python
from django.core import management

if __name__ == "__main__":
    management.execute_from_command_line()

Best Answer

No, a bin directory is not for storing only binary files. It's for keeping executable files, primarily.

Historically, before scripts written in various scripting languages became more common, bin directories would have contained mainly binary (compiled or assembled) non-text files, as opposed to source code. The main thing about the files in bin nowadays is that they are executable.

An executable script is a text file, interpreted by an interpreter. The script in your example is a Python script. When you run it, the python interpreter (which is another executable file somewhere in your $PATH) will be used to run it.

Also, as an aside, a text file is as much a file made up of zeroes and ones as a binary file is.

Related Question