There are various file types, such as mp3
, avi
, iso
, pdf
, png
, html
and more. Each has associated apps for opening the file format. And, here’s how to set the default apps for file types in Ubuntu in 3 ways. Choose the one accordingly.
Option 1. Set default apps for Web, Mail, and Media files:
For web browser, email client, audio/video player and image viewer, it has options in control center to change the default apps.
Firstly, open ‘Settings‘ (aka, gnome-control-center) from upper right corner system tray menu.
Next, go to ‘Default Applications‘ from left pane. There you’ll see the options to select default apps for these file types.
Option 2. Set default apps via Files’ Properties Dialog:
For a certain file type, it’s also easy to set the default app to open it via file ‘Properties’ dialog.
Firstly, select one of the files with certain format in file manager. Right-click or press Ctrl+i on keyboard to open its “Properties” dialog.
When it opens, navigate to “Open With” tab. Now, just select an app from ‘Recommended Applications‘ list and click on “Set as default” button.
After that, all files with same format will open by default with the new app you set!
Option 3. Set default apps via MIME type (Universal):
In Linux, the way it chooses default apps depends on MIME type! MIME (aka, Multi-purpose Internet Mail Extensions) is a standard way of classifying file types on the Internet.
There are “mimeapps.list” configuration files in system that specify the default apps for different file types. The files usually locate in .config
, .local/share/applications
, or /usr/share/applications
.
Without editing the configuration file, there are command line tools xdg-mime
and gio mime
to manage file types.
1.) Check the file type
If you don’t know the MIME type of a certain file, open terminal (press Ctrl+Alt+T on Ubuntu) and run command:
xdg-mime query filetype /PATH/TO/YOURFILE
Tip: drag and drop file into terminal will input the PATH automatically!
For example, I have the elementary OS .iso file in Downloads folder. So, check it type with command:
merilyn@focal:~$ xdg-mime query filetype ~/Downloads/elementaryos-6.1.iso
application/x-cd-image
It outputs “application/x-cd-image” which is the MIME type!
NOTE: here are some MIME types present via link rather than a local file: x-scheme-handler/sms
, x-scheme-handler/tel
, x-scheme-handler/magnet
.
2.) How to Tell the default apps:
After getting the MIME type, use either commands below to get the current default:
xdg-mime query default application/x-cd-image
or
gio mime application/x-cd-image
Please change the MIME type “application/x-cd-image” to yours.
3.) Change default app for certain MIME type:
And, you may use the commands to set another app to handle the MIME type:
xdg-mime default <app.desktop> application/x-cd-image
or:
gio mime application/x-cd-image <app.desktop>
NOTE: specify default app via its .desktop
file, which should locate in ‘/usr/share/applications’ directory. Un-registered apps also supported.
Recent Comments