We all have our preferences when it comes to the application we want to use for opening and working with a certain file type. For example, whenever I start using a new version of an operating system, I install and switch to the VLC media player for playing music and videos. In Ubuntu, you can change your default applications both through the command line and the graphical user interface through the simple steps described in this tutorial. We have performed the commands and procedure described in this tutorial on the latest Ubuntu 18.
Change Default Apps Through the Command Line
When you access any application through the command line by a generic name, such as ‘editor’, it looks for the default application set in the system and points to the exact default application and opens it. For example when I enter the following command:
$ /usr/bin/editor
It opens the Nano editor on my system as it is the default text editor for Ubuntu 18.04 (Bionic Beaver).
If you want to change the default editor or any other program for that matter, you can use the update-alternatives utility for this purpose.
Syntax:
$ sudo update-alternatives --config [applicationname]
Example: Changing the default text editor
In this example I will change my default Nano editor to another preferable alternative through the following command:
$ sudo update-alternatives --config editor
This command will give me an entire list of alternatives for the text editor along with the one with auto mode status as follows:
By entering a selection number associated with my choice and then pressing Enter, I can switch to a new default text editor that will be used to open my text files next time by default.
Note:
If you use this command to look up for alternatives but none exists, you will get the following message. You will then require downloading an alternative and then switching to it.
Searching for alternatives all at once
The following command will list, and let you choose from, an available list of alternatives for all your default applications.
$ sudo update-alternatives --all
The following output is displayed for my system, representing that there are alternatives available only for the editor applications. By specifying a selection number and hitting Enter, I can change the default editor for my Ubuntu.
Change Default Apps Through the GUI
A more user-friendly alternative to changing your default applications is through the user interface. We will represent the following two ways to do so:
- Through the Settings utility
- By specifying default application for opening a certain file
Through the Settings Utility
Click the downward arrow located at the top right corner of your Ubuntu desktop and then click the settings icon located at the bottom left corner:
OR
Type Settings in the Ubuntu Dash as follows:
The Settings utility will open displaying the Wi-Fi tab as default.
Then click on the Details tab and then the Default Applications tab.
The following view will list all the default applications of your system.
In order to choose a different application than the default one, click the downward arrow and make a new selection against a category as follows:
In this image, I have selected Shotwell Viewer to open my photos instead of the default Image Viewer application.
Changing Default Application for Removable Media
Through the Devices tab in System Settings, select the Removable Media tab. The list of removable media and the default program to open the media will be displayed.
In order to change the default application, click the down-arrow beside the Other Application drop-down and select the application from the Select Application dialog as follows:
Your newly selected application will now be used for opening the removable media from then on.
Changing Default Application for Opening a Certain File Type
By setting the default application for opening a certain file, you can select the default application for opening all files of the same type. Here is an example:
Example: Setting all .png files to be opened in Shotwell Viewer
Through the file viewer, right-click a file with the .png extension and then select Properties as follows:
The Properties window will open.
Click on the Image tab and select Shotwell Viewer (or any other preferable applications) and then click Reset.
Your newly selected application will not only open this .png file in the future but also all other files with .png extension.
In this tutorial, you have learned several ways to change the default application used to open a file on your Ubuntu system. You can use both the command line or the two ways described in this tutorial for the GUI to select new applications that will be used to open your files.