I have a file with .dat extension how can i view the contents of the file in hexa ? mean if i open the file i should be able to see the contents in hex format, can this be done using vim editor. I have installed tnef but when i try opening this dat file it says "Seems not to be a TNEF file"
Linux – How to view the contents of .dat file in linux
First of all, Linux (the operating system) doesn't choose anything in what you describe (so the title is rather off), it is either the application you're clicking the file on or the desktop environment that makes the choice based on logic and information.
You mentioned update-mime-database, which leads to Gnome with some googling, and this page specifically:
https://developer.gnome.org/shared-mime-info-spec/ (which is just a replica of this: http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html)
Each application that wishes to contribute to the MIME database will install a single XML file, named after the application, into one of the three /packages/ directories (depending on where the user requested the application be installed). After installing, uninstalling or modifying this file, the application MUST run the update-mime-database command, which is provided by the freedesktop.org shared database.
update-mime-database is passed the mime directory containing the packages subdirectory which was modified as its only argument. It scans all the XML files in the packages subdirectory, combines the information in them, and creates a number of output files.
And here's the gotcha:
Where the information from these files is conflicting, information from directories lower in the list takes precedence. Any file named Override.xml takes precedence over all other files in the same packages directory. This can be used by tools which let the user edit the database to ensure that the user's changes take effect.
So it might be that because Geany just happens to appear "lower in the list" it takes precedence. Lower here might mean anything, I guess, from alphabetical ordering of the respective files to the ordering among some predefined application list.
That page also describes the format of the files, and also mentions that additional tools might be available for manipulating the database (Override.xml specifically). As for if such tools exist might be worth another question.
Edit: This answer on using
mimeopenmight also prove helpful to you even though it might not apply to your specific file manager of choice:
Run this instead:
./ refers to the current directory.
If you run it without
./, Linux will look for a program called
vmware-install.pl in your executable path, but the current directory is never in the path by default (for security reasons).
Some common Linux utilities for viewing hex dumps are: