LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 02-07-2003, 10:36 PM   #1
manaa
LQ Newbie
 
Registered: Feb 2003
Posts: 1

Rep: Reputation: 0
Question Linux file extension vs Dos file Extension?


please compare or describe linux file extension with DOS /Window file extensions.
thanks
 
Old 02-08-2003, 01:19 AM   #2
rnturn
Member
 
Registered: Jan 2003
Location: Illinois (Chicago area)
Distribution: Red Hat (8.0), SuSE (10.x, 11.x, 12.2, 13.2), Solaris (8-10), Tru64
Posts: 982

Rep: Reputation: 53
Re: Linux file extension vs Dos file Extension?

Quote:
Originally posted by manaa
please compare or describe linux file extension with DOS /Window file extensions.
thanks
Well, for one thing, DOS actually interprets the file extension and loads the program in a certain way (depending on the extension) to run it. Windows uses the file extension to tell it which application to run to process the file (Word to handle .DOC files, etc.).

UNIX/Linux doesn't use file extensions to figure out how the program should be run. Now some Unix/Linux applications will use a file extension to figure out what to do with a particular file. The best example is Netscape/Mozilla/etc. These browsers use the file extension to launch the correct helper application when you click on a file. I expect that the Nautilus file manager does something similar to tell it how to display an image or how to play an audio file when you leave the mouse on it.

But for things like scripts or compiled programs the use of an extension is mostly to help us humans know what the file is. The perl script `myperl' and `myperl.pl' are two entirely different files. I could write a perl script and name it `myperl.exe' and perl wouldn't care (though I'd have to run it as `myperl.exe' and not just `myperl'. Bottom line is that file extensions are -- for the most part -- optional. You can use them to help you remember what the file contains or you can leave 'em off and use the `file' command to figure out what's inside.

Hope this was helpful,

Rick
 
1 members found this post helpful.
Old 02-12-2009, 01:40 PM   #3
studiogrynn
LQ Newbie
 
Registered: Feb 2009
Posts: 8

Rep: Reputation: 7
So how does Linux know?

So then, is Linux using a resource fork like Mac, a registry like M$ or does is it intelligent enough to look into the file header to find the type?
 
Old 02-12-2009, 01:53 PM   #4
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,214

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
the file command uses something called a magic database (http://linux.die.net/man/5/magic) to find out file types.

unlike windows if you rename hello.doc to hello.mp3, windows will think it is an mpeg layer 3 audio file.
whereas in linux if you rename hello.doc to hello.mp3, it will continue to know it is an open-office document.
 
1 members found this post helpful.
Old 02-12-2009, 02:24 PM   #5
farslayer
Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 189Reputation: 189
man file for an explanation of how it works..
 
Old 02-12-2009, 04:29 PM   #6
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 3,919

Rep: Reputation: 779Reputation: 779Reputation: 779Reputation: 779Reputation: 779Reputation: 779Reputation: 779
Hey, these homework questions get better!

The unix tradition is that what you call the filename extension doesn't have a particular meaning. the dot is just one of the chars that you can use for a filenname, so, for example

data.mp3.bak.obsolete

would be a valid, but unusual, filename, where the dos/windows tradition wouldn't like that.

given that the Unix tracition gives no special significance to a three char file type and the dot as a separator, it is unsurprising that the OS doesn't do anything in particular with those three chars. Although, a layer on top of the OS (apps, the GUI if you have one) could use three chars for something special, although you could argue that this is against tradition (for what that's worth).
 
1 members found this post helpful.
Old 02-12-2009, 05:19 PM   #7
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,056

Rep: Reputation: 94
http://letmegooglethatforyou.com/?q=...ile+extensions

there you go.
 
  


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
why when redirecting output to a file any file extension seems to be fine? dr_zayus69 Linux - General 1 05-21-2005 05:09 AM
Why when editing files does Linux create a duplicate file with a ~ in the extension? bugbite99 Linux - General 6 01-17-2005 03:21 PM
.la file extension n_hendrick Linux - Newbie 1 01-11-2004 05:20 PM
how to install sound and modem driver in tar.gz file extension in linux 7.3 nomi Linux - General 2 09-17-2003 02:24 PM
file extension help Netrack Linux - Newbie 9 01-21-2003 09:53 PM


All times are GMT -5. The time now is 11:54 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