Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513
Rep:
1) Files ending with ' .bin ' are most often binary installers.
And you are not getting a name. The name is decided by you, if
you are creating the file.
2) Most files can be renamed to any name and still be recognized
as their particular file type. The command 'file' can be used or
you can ask "Properties" to tell by right clicking the file.
In the desktop manager KDE : hoover the mouse cursor over the
file and get the type.
.....
Another example : 'photo.jpg' can be renamed to 'my-photo'
and still be opened by your favorite image viewer. No extension !
.....
To explain it from my understanding, its like this.
You state that when you compile a program using gcc you get a lot of a.out files. This is because you didn't specify a name. Using gcc --help or man gcc you can learn each different compiler option. To make a name you do this.
gcc -o MyProgram MySource.c
That takes your program that is called MySource.c and creates a file called MyProgram. Unlike windows the . extension is meaningless. A .bin file simply means a binary file. Which in the case I showed above MyProgram IS a binary file. So if you need to have a .bin extension you could do this.
gcc -o Prog.bin MySource.c
And there you go. Though Prog.bin and MyProgram are the same file with a different name.
I have been reading the web and i found that they say the equivalent of .exe in linux is either .elf or .bin, is that true?
No, it isn't. There are any number of files that are executable, and not because of their extension. Unices have an executable flag that is part of the information stored about a file, and that flag determines whether the file is executable.
In Windows, by contrast, a file's extension is important because the Windows file system is too primitive to include the concept of an executable flag.
Quote:
Originally Posted by raedbenz
how do i get a file with .bin or .elf extension? cause AFAIK when compiling using gcc we get a.out.
thanks
Use the "-o" option to choose a file name and extension:
$ gcc source.file -o output.file
It is up to you to decide whether the extension you choose is appropriate to the circumstances.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.