How do I set the default program that I use?
I have tried to open System Info → Default Program → change my program, but it won't work,
Any idea? Or should I use Terminal?
I want to replace the default movie player with VLC media player, because the current movie player is useless to me.
There's yet another GUI solution, which might come handy for you ;)
Try opening the properties (right click -> Properties) of the file type you want to be always played by VLC.
Choose the Open with tab and either choose from a list or add one (by choosing from an extended program list or simply typing vlc as the command)
EDIT:
... and click on Set as default
If you're really desperate, just manually edit the file
~/.config/mimeapps.list
.format:
Just add this under the
[Default Applications]
section if you want it to be default, or under[Added Associations]
if it shouldn't be default.Some programs still use the now deprecated
~/.local/share/applications/mimeapps.list
, however, best is to make that a symlink to~/.config/mimeapps.list
to have a single config for this:Choice number one: Open a terminal where your file is and do the following command.
There is the output:
Use application #3
Use command: vlc %f
Press 1 if you see vlc, if not, chose the Other solution (3 in that case). Then type the name of your application followed by %f.
Choice 2: Generic way
And then do the step above.
Use Ubuntu Tweak - it has a file association manager and you can choose which programs open which file types.
Instructions are on this site http://www.omgubuntu.co.uk/2011/12/new-version-of-ubuntu-tweak-released/
Best way to install is:
EDIT In newer versions of Ubuntu, follow Paulius's answer, the option has been added to the Properties -> Open With screen.
To associate an aplication to a MIME Type:
works from the commandline, and is obey instantly by all GTK apps (and possibly Qt apps?). For example, to change the default PDF reader to Okular, use:
This is really useful for updating the default apps used by GTK when using a Qt based system without having to install any GTK-based apps.
Edit: on *buntu flavoured linuxes, the applications that can be used with this method are at
/usr/share/applications/*.desktop
. The known mimetypes can be found in/usr/share/applications/defaults.list
.For those looking for setting an application association for file extensions, NOT a mimetype:
Apparently, Ubuntu / Linux keeps this indirectly:
For Ubuntu (18.x), these are described in:
file extension -> MIME types
This is in files in
/usr/share/mime/packages/
. E.g.:MIME type -> application(s) to open
This is driven by
~/.local/share/applications/mimeapps.list
and detailed the other answers.Applications -> list of compatible MIME types
This is driven by the
.desktop
files in/usr/share/applications/
. That file can contain aMimeType=
entry with semicolon-separated list of MIME types. For instance, the EOG app has:MimeType=image/bmp;image/gif;image/jpeg;image/jpg;...
etc.This makes it a full circle. The changes take effect after running
and, for icons,
Or, it may need you to logout/login.
Then, you should be able to see this:
Reference: https://coderwall.com/p/qjda2q/create-new-mime-type-and-assign-an-icon-to-it-in-ubuntu
I was having a similar problem with PDFs; I had installed Adobe Reader, but I couldn't get it to open them as the default application - it didn't even show up on the lists!
I checked the mimeapps.list file listed above, and it was already listed as default there.
This is what worked for me finally:
I guess that "Reset" was necessary after the (rather inconventional) installation to register it as the default program.
Here's how I did it without using the Ubuntu Tweak tool. My guide includes file type associations, so that your app will be listed in the "Recommended Applications" when right-clicking the file to see the properties. Guide as follows (I'm using 13.10 Saucy):
When you see a command, run it in terminal, of course :)
cd /usr/share/applications/
cp similar_program.desktop name_of_your_program.desktop
gedit name_of_your_program.desktop
[Desktop Entry]
as the top lineif you want to add support for the name in other languages just add a new line that says for instance:
modify the
Exec
(should just sayyourprogram %f
as long as it's a default install with the program in/usr/bin
)MimeType
(unless it's the same)Icon
(again, if it's a default program installed to (/usr/bin
) this should just sayIcon=name_ of_your_program
NoDisplay=true
StartupNotify=true
gedit ~/.local/share/applications/mimeapps.list
In my instance I wanted to add PlayonLinux to select as a program to open
.exe
files, instead of always using WINE. But I wanted Wine to show up too.In this case, you can leave the top section
[Default Applications]
alone. Then find the line under[Added Associations]
, and change it from, in my instanceto
This way they both options will show up when I try to load a Windows
.exe
file.If you right-click the properties on the file, and for instance say I eventually do want to make PlayonLinux the default for Windows
.exe
files, all I need to do is tell it to be set as default. And it will change. You can check themimeapps.list
(~/.local/share/applications/mimeapps.list
) to double-check and you'll now see it will have replaced WINE under[Default Applications]
.Discover and change default program via CLI
As naught101s' answer only presents the last bit of all the steps that I did, and supplementing/improving his post/answer with all the extra bits I have, I considered too much of a difference to his original answer. So here is yet another answer xD with the steps I did:
Open a terminal:
or
B) With the directory open in Nautilus click on the "down arrow" of the folder name and select the option Open in Terminal. A terminal window will appear already in that directory as base.
Discover MimeType of file: Find out which MimeType is associated to your filetype with the xdg-mime tool.
Discover current associated default program: For reference (in case you want to revert to what was originally there): You can query which default application is currently associated to this mime-type.
Note: You can get extended info where it looks for the using the local Environmental debug parameter "
XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default image/png
".Discover programs that support specific MimeType: Now using the find command we search for .desktop files (shortcuts to installed software) which have indicated that they support this MimeType.
The -exec <command> '{}' ';' executes grep to search for the text "image/png" within each match of .desktop file found from find.
Set new default program: Indentify the
.desktop
shortcut associated to the software you want to set as default and set it.For Dolphin (KDE), right click the file to get a Properties window. Under Type is a button for File Type Options, where you can modify filename extensions. Add the application if it's not in the bottom list. To make it default, move the application you want to the top of the Application Preference Order list.
Screenshot from a more detailed guide: