In simple terms, what you are looking to create is a binary file, one that does not store text but is essentially a list of instructions to the Linux kernel to execute some kind of program.
Typically, these files are created by a program called a compiler. Common examples of programming languages where code is compiled to create binary executables include C, C++, and Fortran. gcc
and gfortran
are the corresponding programs that can turn your code into a binary executable. While it is possible to create a binary file from Python, this is not the norm.
In Linux any file can be marked as an "executable" and unlike Windows, the file extension has no bearing on its executability or its content (i.e. whether it is a binary or text file, or whether it contains C or Python code) although it can serve as a reminder. The command chmod
allows you to change the read, write and execute permissions of a file with any extension. When you compile code with gcc or gfortran on a typical Linux system, it will automatically be marked as executable.
C
orC++
and havegcc
(the compiler) andld
(the linker) create a binary for you. – PerlDuck Sep 11 '18 at 16:11