If you ever wonder why MacOS users have a nice little command-line application called “open” to open an arbitrary file with the correct application, and you – a proud Linux user – don’t, you have come to the right place :)
If you use GNOME (KDE sucks :P) you probably have a nice little command-line application called “gnome-open”.
It does exactly what you are thinking. It find the mime-type of the file you pass as a parameter and use the GNOME configured application for that mime-type.
Since I am lazy (and probably you too) don’t forget to put this on your .bashrc (or equivalent):
alias open="gnome-open" alias o="gnome-open"
Have fun with your console!
(Probably KDE (and others) have a similar application)