Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the difference between "binaries" and "executables" in the context of an executable program?

I often see the terms "binary" and "executable" seemingly used interchangeably for the same thing.

Ain´t it two terms to describe the exact same thing; The executable output program after a compilation process, which I can run on the terminal?

What do strengthen my assumption, that these two things shall be the same is also, that it is a common practice to provide a bin folder ("bin" as abbreviation for "binaries") inside the installation folders of an application, to store the executable files in, which users are be able to run.


I have read the question and answers of What's the difference between binary and executable files mentioned in ndisasm's manual? but the question and their answer are more focused on the respective environments of Clang and ndisasm.

I´ve also read the question and the answers of https://softwareengineering.stackexchange.com/questions/121224/what-are-binaries at the Software Engineering forum, but also here no distinction between an executable and a binary; only what the term of "binary" in general can refer to:

But, in Computing, Binary refers to :

  • Binary file, composed of something other than human-readable text
  • Executable, a type of binary file that contains machine code for the computer to execute
  • Binary code, the digital representation of text and data

[Source: https://softwareengineering.stackexchange.com/a/121235/349225]

where, in the context of the output program of a compilation process, a binary was referred to as the same as an executable, as well as:

The word binaries is used as a set of files which are produced after compiling essentially the object code that runs on machines. (and virtual machines/runtimes in case of Java/.NET)

[Source: https://softwareengineering.stackexchange.com/a/121234/349225 ]

where it was referred to the same.


  • What is the difference between "binaries" and "executables" in the context of an executable program?
  • Where is the distinction?
like image 667
RobertS supports Monica Cellio Avatar asked Jan 20 '20 15:01

RobertS supports Monica Cellio


People also ask

What is the difference between a binary and an executable?

But, in Computing, Binary refers to : Binary file, composed of something other than human-readable text. Executable, a type of binary file that contains machine code for the computer to execute. Binary code, the digital representation of text and data.

Is a binary file an executable?

Summary. A binary executable file is a file in a machine language for a specific processor. Binary executable files contain executable code that is represented in specific processor instructions. These instructions are executed by a processor directly.

What is the difference between a program executable and process?

A Program is an executable file which contains a certain set of instructions written to complete the specific job or operation on your computer. A Process is an execution of a specific program. It is an active entity that actions the purpose of the application.

What is executables in programming?

An executable is a file that contains a program - that is, a particular kind of file that is capable of being executed or run as a program in the computer. In a Disk Operating System or Windows operating system, an executable file usually has a file name extension of . bat, .com, or .exe.

What is the difference between a file and an executable file?

Executable files communicate directly with the computer, giving it a set of instructions to run. By contrast, with data files, another program must interpret or parse them before the machine can use them.

What are binaries in programming?

When referring to a download or program, binaries are compiled code that allow a program to be installed without having to compile the source code. Many open source programs offer downloads in source format. This format allows users to view the code, but also requires the code to be compiled or in binaries format.


2 Answers

An executable file is one which can be executed; you would run it on the commandline by writing the name of the file itself as the command. On Unix systems, the file's "executable" flag must also be set. On Windows, the file's extension must be one of a fixed set of executable file extensions, including .exe.

A binary file is simply one in a binary (i.e. non-text) format. The binary format means that the file's contents should not be transformed for platform-specific reasons (e.g. replacing newlines from \n to \r\n).

Binary files are not necessarily executable, for example a library compiled to .dll or .so form is a binary but not an executable. A Java program compiled to .class or .jar form is not an executable file, but might be run using the command java -jar program.jar rather than the command ./program.jar.

Executable files are not necessarily binary, for example a Python script in text form can be made executable on Unix systems by writing a shebang line #!/usr/bin/python3 and setting the file's executable flag.

like image 136
kaya3 Avatar answered Sep 22 '22 17:09

kaya3


It helps to understand the context of the term "binary" here. It originates from compilers, which take the (text-based) source code of a program and turn that source code into an excutable form which is binary, not text-based. Thus in the context of compilers, "text" and "source code" are equivalent, as are "binary" and "executable". Interpreters on the other hand do not make the distinction between source code and executable code.

Things definitely got more complex over time with intermediate representations, such as used by the Java JVM, .Net's CLI or Python bytecode.

like image 36
MSalters Avatar answered Sep 23 '22 17:09

MSalters