LinuxQuestions.org
Review your favorite Linux distribution.
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, 08: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, 08:36 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,260

Rep: Reputation: 2660Reputation: 2660Reputation: 2660Reputation: 2660Reputation: 2660Reputation: 2660Reputation: 2660Reputation: 2660Reputation: 2660Reputation: 2660Reputation: 2660
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 08:39 AM.
 
Old 09-14-2009, 08: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, 09:08 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,260

Rep: Reputation: 2660Reputation: 2660Reputation: 2660Reputation: 2660Reputation: 2660Reputation: 2660Reputation: 2660Reputation: 2660Reputation: 2660Reputation: 2660Reputation: 2660
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, 09: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, 02:58 PM   #6
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,036

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
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, 07:00 PM   #7
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 101Reputation: 101
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, 01:34 AM   #8
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

Rep: Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041Reputation: 2041
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 07:06 PM
Linux file extension vs Dos file Extension? manaa Linux - Newbie 6 02-12-2009 05:19 PM
extracing bin extension file ramesh_manu Linux - Desktop 1 01-11-2007 03:10 PM
How do I install a download with extension .bin? CharlesW Linux - Newbie 4 10-07-2003 04:59 AM


All times are GMT -5. The time now is 01:03 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration