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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
02-07-2003, 09:36 PM
|
#1
|
LQ Newbie
Registered: Feb 2003
Posts: 1
Rep:
|
Linux file extension vs Dos file Extension?
please compare or describe linux file extension with DOS /Window file extensions.
thanks
|
|
|
02-08-2003, 12:19 AM
|
#2
|
Senior Member
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,849
|
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.
|
02-12-2009, 12:40 PM
|
#3
|
LQ Newbie
Registered: Feb 2009
Posts: 8
Rep:
|
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?
|
|
|
02-12-2009, 12:53 PM
|
#4
|
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,326
|
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.
|
02-12-2009, 01:24 PM
|
#5
|
LQ Guru
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Rep: 
|
man file for an explanation of how it works..
|
|
|
02-12-2009, 03:29 PM
|
#6
|
Senior Member
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070
|
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.
|
02-12-2009, 04:19 PM
|
#7
|
Senior Member
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098
Rep: 
|
|
|
|
All times are GMT -5. The time now is 01:42 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|