If the file already exists, open it.
# update-mime-database /usr/share/mime
# update-mime-database ~/.local/share/mime/packages
# update-mime-database /usr/share/mime
For example, the gnomevfs-info command displays the following output when you run the command for a SVG file. Note that the default application for this MIME type is eog.desktop.
$ gnomevfs-info mime-diagram.svg Name : mime-diagram.svg Type : Regular MIME type : image/svg+xml Default app : eog.desktop Size : 14869 Blocks : 32 I/O block size : 4096 Local : YES SUID : NO SGID : NO Sticky : NO Permissions : 600644 Link count : 1 UID : 1000 GID : 100 Access time : Wed Feb 22 18:24:47 2006 Modification time : Wed Feb 22 18:24:42 2006 Change time : Wed Feb 22 18:24:42 2006 Device # : 775 Inode # : 297252 Readable : YES Writable : YES Executable : NO $
For more information about default applications, see Registering Applications for MIME Types.
Create a new file, test.xyz, in your home directory.
Use the gnomevfs-info command to find the file's MIME type.
$ gnomevfs-info text.xyz
The MIME type for this file should be detected as text/plain because no glob patterns or magic rules match the file.
Create the Overrides.xml file or if the file already exists, modify the file.
The sample XML file is as follows:
<?xml version='1.0' encoding='utf-8'?> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> <mime-type type="application/x-newtype"> <comment>new mime type</comment> <glob pattern="*.xyz"/> </mime-type> </mime-info>
Update the MIME database by using the update-mime-database command.
# update-mime-database /usr/share/mime
Use the gnomevfs-info command to verify that your change has taken effect.
$gnomevfs-info testing.xyz | grep MIME MIME type : application/x-newtype
You should see that the MIME type for the testing.xyz file is resolved as application/x-newtype.