LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 09-14-2009, 07:22 AM   #1
raedbenz
Member
 
Registered: Dec 2007
Posts: 93

Rep: Reputation: 15
.bin, .elf, .out - Linux file extension


Hi,,

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?

how do i get a file with .bin or .elf extension? cause AFAIK when compiling using gcc we get a.out.
thanks
 
Old 09-14-2009, 07:36 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Linux and other *nix don't use / need extensions.
Have a look in e.g. /usr/bin/ or do 'ls /usr/bin/'
.....

You only get a.out with no name specified.

' -o myobject ' will create 'myobject'
.....

Last edited by knudfl; 09-14-2009 at 07:39 AM.
 
Old 09-14-2009, 07:51 AM   #3
raedbenz
Member
 
Registered: Dec 2007
Posts: 93

Original Poster
Rep: Reputation: 15
Hi,,

And what about getting a file extension .bin?
i have seen some executables with .bin extension, how do we get that?
 
Old 09-14-2009, 08:08 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
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 !
.....
 
Old 09-14-2009, 08:43 AM   #5
archlinux_jessica
Member
 
Registered: Aug 2009
Location: PA USA
Distribution: Arch Linux
Posts: 78

Rep: Reputation: 19
Explination

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.

-Jessica-
 
Old 09-14-2009, 01:58 PM   #6
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
And what about getting a file extension .bin?
i have seen some executables with .bin extension, how do we get that?
You just rename executable to executable.bin
The extension is irrelevant to linux.
Test it out:
Code:
tred@vaio:~$ file image.jpg
image.jpg: JPEG image data, JFIF standard 1.01
tred@vaio:~$ cp image.jpg image
tred@vaio:~$ file image 
image.jpg: JPEG image data, JFIF standard 1.01
tred@vaio:~$
The file image will still open with the default application associated with the filetype JPG, even though it lacks the .jpg extension.

(Linux is usually more sensible than win.)
 
Old 09-14-2009, 06:00 PM   #7
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by raedbenz View Post
Hi,,

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 View Post
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.
 
Old 09-15-2009, 12:34 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,361

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
ELF is a (*nix) binary format: http://en.wikipedia.org/wiki/Executa...inkable_Format, not an extension.
As said above, xxx.bin is (usually) a self-extracting installer.
HTH
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
powerpc-elf/bin/ld: no memory region specified for loadable section `.abs.00010... olowo726 Linux - Embedded & Single-board computer 1 07-25-2009 06:06 PM
Linux file extension vs Dos file Extension? manaa Linux - Newbie 6 02-12-2009 04:19 PM
extracing bin extension file ramesh_manu Linux - Desktop 1 01-11-2007 02:10 PM
How do I install a download with extension .bin? CharlesW Linux - Newbie 4 10-07-2003 03:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration