If you are on a Linux shell and want to open a file with whatever default application is configured for that type, this often works:
xdg-open Quote.odt
xdg-open invoice.pdf
xdg-open index.html
Pro Tip
Make an alias so you have a simpler API (like Mac OS): alias open=xdg-open
or alias x=xdg-open
.
Background
You can choose your "Default applications" via UI in the Ubuntu "Settings" application (gnome-control-center
). This is just a very rough setting (e.g. open Photos with Shotwell Viewer).
If a certain file type (or better mime type) should be opened with a different application, this can be set via command line:
# Query the default application:
xdg-mime query default $(xdg-mime query filetype <file>)
# Override the default application for this filetype with:
mimeopen -Dd <file>
Changed mime default are stored in ~/.config/mimeapps.list
(and sometimes ~/.config/*-mimeapps.list
).
Further reading
Posted by Henning Koch to makandra dev (2016-03-02 14:37)