Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Can anyone distinguish the difference between binary file and .exe file?

share|improve this question

closed as unclear what you're asking by slm, Anthon, jasonwryan, manatwork, terdon Nov 29 '13 at 14:19

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

    
"Binary file" requires further qualification/context, as it has multiple meanings. –  Ignacio Vazquez-Abrams Nov 29 '13 at 6:27
1  
Is the purpose of this question to clarify binary vs. executable files, or the difference between the .bin and .exe filename extensions? –  l0b0 Nov 29 '13 at 15:03
    
The question is just fine. They're talking about colloquial use of the word binary. If the word binary is ambiguous then the answer should be more comprehensive. See accepted answer. –  user391339 Nov 14 at 8:26

3 Answers 3

up vote 7 down vote accepted

binary file is pretty much everything that is not plain text, that is contains data encoded in any different way than text encoding (ASCII, UTF-8, or any of other text encodings, e.g. ISO-8859-2). A text file may be a plaintext document, like a story or a letter, it can be a config file, or a data file - anyway, if you use a plain text editor to open it, the contents are readable. A binary is any file that is not a text file (nor "special" like fifo, directory, device etc.)

That may be a mp3 music. That may be a jpg image. That may be a compressed archive, or even a word processor document - while for practical purposes it's text, it is encoded (written on disk) as binary. You need a specific program to open it, to make sense of it - for a text editor the contents are a jumbled mess.

Now, in Linux you'll often hear "binaries" when referring to "binary executable files" - programs. This is because while sources of most programs (written in high-level languages) are plain text, compiled executables are binary. Since there are quite a few compiled formats (a.out, ELF, bytecode...) they are commonly called binaries instead of dwelling on what internal structure they have - from user's point of view they are pretty much the same.

Now, .exe is just another of these compiled formats - one common to MS Windows. It's just a kind of binaries, compiled and linked against Windows API.

share|improve this answer

Batch files are really just text files, or small scripts which can be executed by command line processor - "cmd.exe", they where widely used in DOS environment for automation of common tasks.

EXE files are different from BAT files since they contain executable binary data rather than plain text commands. They are stored in the Portable Executable (PE) format. The EXE file format includes various headers and sections that tell Windows how to run a program. Some portions of an EXE file may contain program code while others may contain resource data.

share|improve this answer

Generally it can be said that there is no difference: in MS Windows OS executables have names *.exe, but in *nix-like OS executables can be named whatever you like and are called "binary files".

But it doesn't mean that every binary file is executable (like *.exe): binaries could be just a kind of information storages. For example, database files (such as MyISAM or InnoDB files for MySQL databases) are binary files too (but not executable).

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.