How do I view the code behind an .exe program on Linux? I want to see the programs code because I want to see how it works. I am just learning coding, so I thought the program would be cool to look at!
-
What is a .exe? File extension are just visual markers for us humans ;-) If you meant an executable in linux it will be easier to find the source code in the repositories.– RinzwindNov 16, 2015 at 21:04
-
Combined with askubuntu.com/q/481/158442– muruNov 16, 2015 at 21:06
-
Yes Rinzwind. How do I do that?– VoyagerLinuxGamerNov 16, 2015 at 21:07
3 Answers
If you want to see the source for Linux executables, install the apt-src
package (sudo apt-get install apt-src
), and read man apt-src
. Then you can use apt-src
to get the source for ANY Ubuntu package.
There exists something know as decompiler
. When you create a program in a compiled language, such as C, you use compiler that translates human-readable code into machine-level code. Decompiler does the opposite. Here's a small list of C decompilers, from stackoverflow question.
I don't have experience with decompilers , but my guess is that if a program is non-open source, you wouldn't be able to decompile it.
With open-source apps , it's easier - you can use apt-get source package-name
or just look up an app on git-hub
-
1It doesn't matter whether the source code was open source or not, the problem is that often being the compilation not a 1:1 conversion there are multiple "ways" back to an equivalent source code, so the decompiled source might not be identical, although functionally equivalent; nonetheless preprocessor directives, comments and whitespace are lost, and symbols are not always recovered; sequences of bare assembly instructions in the decompiled source code are frequent.So unless you're using a really good decompiler and you're lucky enough you usually get only a rough idea of the original source.– kosNov 17, 2015 at 8:17
You cant, .exe are executable binaries for windows, there's no code, just machine instructions. If you use Linux or Mac you can easily find the raw sources in the temp src folder of your package manager (brew, yum, apt-get...), Unix systems downloads the sources and (sometimes) builds it on your own machine
-
Normally only binaries are downloaded. You have to ask for the source code if you want it with
apt-get source packagename
. And of course, the question was about a windows executable, for which this does not apply.– psusiNov 16, 2015 at 23:29