Re: associating extensions with applications



I am not sure what the "GUI" (e.g. gnome) use to identify applications.

As to file types, the standard from a command window is to use the
"file" utility, as in
file someFileName
The file utility uses a traditional file identification system known
as the "magic" system. This system has been enhanced over the years,
but basically reads a certain number of bytes from the beginning
of a file and then uses a pattern matching technique against a list
of patterns. The first match then identifies the type of file.

On a machine here, the patterns are in the file /usr/share/file/magic.
It is interesting to browse that file. Also
man magic
in a command window gives further information.

Does anyone know whether the desktops (e.g. gnome) are using this
infrastructure (the "magic" system) or have implemented an
independent system for linking applications to files?

Also, I presume that, even if the "magic" system is used to identify
the file type, there must be somewhere in the gnome (or other desktop)
infrastructure that ties an actual application to a file type, e.g.
OpenOffice word processor to word perfect files. Does anyone know
where that linkage is done?



David Fletcher wrote:

On Wednesday 31 January 2007 15:36, Gerhard Magnus wrote:

Does Linux, or more specifically the Gnome desktop, have a widget like
the one in Windows that associates file extensions with applications so
that, for example, when I double-click on a ".txt" file it opens in my
favorite text editor? Do file extensions have any significance in
Linux? Thanks for the help! -- Jerry


Linux is much more clever than that. So far as I know it takes no notice of file name extensions. It looks at the header information inside the file itself.

For instance, today I copied in an old file that was originally prepared using Word Perfect under windoze. Hovering over the file in konqueror the bar at the bottom tells me that it knows it is a Word Perfect file. Changing the file name extension from wpd to doc makes no difference - it still knows that this is a Word Perfect file. This one is a very simple file, but Open Office opens it just fine and displays all the text in it very nicely, thanks very much.

Dave


--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list



Relevant Pages

  • Re: What is magic number in linux?
    ... uses the magic file to identify what the file type is. ... So the magic file may not direct applications to whether or not ... So an mp3 player would check the magic number of a file that it was ... at least some file that the mp3 player can play) will it play it. ...
    (comp.os.linux.misc)
  • Re: Why is Fedora a multimedia disaster? - Here is why.
    ... wouldn't involve opening the file and trying to guess the file type from ... each file access involves ... Applications creating the files must set it explicitly, ... have to start building mime-type attribute awareness into ...
    (Fedora)
  • Re: PROBLEM: 12.1 version of Word 2008 will not open WinWord .doc
    ... If I remove the type code the document opens normally on double-click, presumably now forced to use the extension only to determine file type. ... Any attempt to implicate Mail applications for incorrect handling seems like legerdemain. ... Email steve 'at' shodgson 'dot' org 'dot' uk ...
    (microsoft.public.mac.office.word)
  • conditional FTYPE?
    ... I have a situation which doesn't seem that strange, ... I have one file type (ASSOC .php=PHPFile) which I ... per command window invocation basis (in other words, ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Modifying the "Open with..." list
    ... Clicking with the "ctrl" key offers a list of applications to open a given file type, presumably according to its extension. ... With picture files, you get an incredibly long list including totally useless options courtesy Adobe, such as "constrain to 64 pixels.exe" or "makebutton.exe" whilst I would like to get only the main options, i.e. GraphicConverter, Photoshop and few others. ...
    (comp.sys.mac.system)