LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   File Associations (http://www.linuxquestions.org/questions/linux-newbie-8/file-associations-103909/)

gag 10-14-2003 03:07 PM

File Associations
 
Hi all,
I've been browsing some books from the library and looking at some screen shots of 'konqueror' and seen .jpg and .gif files amongst others which obviously proves that these extensions are recognised. Also however, there are files which appear to have no extension and a number of README files. eg. Readme.config, Readme.dri, Readme.sis etc. (I am assuming here that files named Readme are text files which can be read). Now coming, nay fleeing, as I am from windows, I would expect the extensions of these files to be the same ( e.g. txt) so they could be opened with the same app. Am I wrong or is there a different method of associating files?
Please note that I don't have a Linus system as such but it is in the post as I speak! (Red Hat 9)
Thanks

dxdad 10-14-2003 04:25 PM

KDE looks at the contents of the file and decides what would be good to us to open it. based on it's MIME type, I think.

DMR 10-14-2003 04:36 PM

Linux can use 2 methods to identify file types:

1. Magic Number- a hex code embedded near the beginning of the file. The various registered codes are listed in /usr/share/magic.

2. File extensions- Linux can use file extensions to determine filetype. The extention associations are buried in some deep dark file whose name I've forgotten.

rahulsundaram 10-14-2003 11:56 PM

hi

the bottom line is file extensions are irrelevant. create a file with a .txt extension then its mime type/magic number becomes text. renaming it doesnt
doesnt change the filetype. you can find it out by


file filename in command line

in KDE

right click and view properties. you can also change the filetype in the context menu. Gnome should have similar options

regards
rahul sundaram

DMR 10-15-2003 12:46 AM

Quote:

Originally posted by rahulsundaram
the bottom line is file extensions are irrelevant.
Look into "binfmt_misc"; files can be registered by extention. Granted, this isn't the usual mechanism, but still, it can be done.

:)

gag 10-15-2003 01:14 PM

Thank you all very much.

DMR 10-15-2003 04:34 PM

You're welcome. :)


All times are GMT -5. The time now is 08:36 AM.