How to change the default application for a type of file on Linux
Last updated on October 10, 2022
This howto explains how to change the default program to open all files with a given extension on Linux Mint, Ubuntu, Debian, and most Linux distributions. It also details how to change the default application for a batch of filetypes, for example all audio files or all video files.
Set the default program for a given filetype
1. In Nemo / Nautilus / Caja, right-click on any file with the desired file type or extension, choose “Properties” from the context menu.
2. The “Properties” dialog appears. Click on the “Open With” tab.
3. Select the desired application for the given filetype. All files with the same extension will now be opened with this program by default.
On Linux Mint, replace step one and two choosing “Open With” → “Other Application…” in the contextual menu, as seen in the picture above.
Change the default app for multiple filetypes
Changing the default application for one type of file is really easy, while changing a batch of file type associations reveals a little clumsier, but extremely efficient.
These instructions should work with a large spectrum of Linux flavours, please share your experience with your favorite distribution in the comments.
Associate all audio and video files to VLC instead of Totem media player (Movie Player)
Video files: .avi .mp4 .mpg .ogv .ogm .mkv .wmv etc. Audo files: .mp3 .ogg .flac .wav .wma etc.
Open defaults.list with gedit:gksudo gedit /usr/share/applications/defaults.list
And replace all occurrences of totem
with banshee/rythmbox/vlc
or the media player of your choice. (Search → Replace → Replace All)
Save the modified file, and you’re done! Change are effective immediately.
Associate all office documents to LibreOffice instead of OpenOffice.org or Abiword
Office files: .odt .ods. .doc .docx .xls .xlsx etc.
Open defaults.list with gedit:gksudo gedit /usr/share/applications/defaults.list
And replace all occurences of “openoffice.org” with “libreoffice”. (Search → Replace → Replace All)
Finally, save the file. No need to restart, you’re all set!
Other file associations
Use the same technique to change the default application for all kind of file types or extensions, for example:
- all pictures (.jpg, .png, .gif, etc.) should open up with gThumb instead of EOG/Eye of Gnome/Image Viewer
- all html documents should open with Firefox instead of Chrome
- all pdf files should open with Adobe Reader instead of Evince/Document Viewer.
Different solution for some Ubuntu versions
For an obscure reason, changing the file associations directly in the defaults.list doesn’t seem to work on some Ubuntu versions. Nevertheless, importing information to the the mimeapps.list works.
The file associations for each user are stored in:~/.local/share/applications/mimeapps.list
In Ubuntu this file is almost empty. Let’s import informations from /usr/share/applications/defaults.list
Display all the video MIME types / Media types associations with this command:cat /usr/share/applications/defaults.list | grep video
Append all the lines containing video types to the local file:cat /usr/share/applications/defaults.list | grep video >> ~/.local/share/applications/mimeapps.list
Open defaults.list with gedit:gedit ~/.local/share/applications/mimeapps.list
And replace all occurrences of totem with vlc (Search → Replace…) Proceed similarly for audio files if needed. Unlike the standard method described at the beginning of this article, this method permits to assign a separate program to audio or to video files.
By Johannes Eva, January 2011 – October 2022
This article has been linked on LXer.com, Linux Today and some more…
7 thoughts on “How to set up automatic updates on Ubuntu Server 20.04, 22.04 or 24.04”
is there a way to setup the updates to run on a specific day of the week, eg: Saturdays at 6am? or something like that?
Pingback: LINUX SERVER MANAGE TIPS – CFC Studio
What about the
/etc/apt/apt.conf.d/10periodic
file? It has the same content as/etc/apt/apt.conf.d/20auto-upgrades
.Personally, I would not recommend to configure the auto reboot (step 2).
One of the good things about linux is that nearly all updates do not require system reboot.
This setting makes linux behave like windows, doesn’t it?
It does need to reboot on kernel updates however. And this apparently checks whether a reboot is required before rebooting.
Stu*** comment… you’re just saying it shouldn’t do it because it shouldn’t behave like Windows. Something is not wrong, just because has the same behaviour. Then Linux shouldn’t store data in files, because Windows does the same, it shouldn’t use SSDs, USB disks, ..
Don’t uncomment
${distro_id}:${distro_codename}-updates
unless you know what you’re doing. This will enable unattended NON-SECURITY updates, which may break your server configuration.