In this article, we will guide you through the process of changing file associations from Gedit to another application in Ubuntu. This can be useful if you prefer to use a different text editor or application for certain file types.
To change file associations from Gedit to another application in Ubuntu, you can use terminal commands or Ubuntu Tweak. Terminal commands are quick and easy, allowing you to update the default application for all users or just your user. Ubuntu Tweak provides a graphical interface for changing file associations, but it is only available for Ubuntu versions prior to 16.04.
By default, Ubuntu uses the Gedit text editor to open text files. While Gedit is a powerful and user-friendly text editor, you might prefer to use a different application, such as Sublime Text or Atom. Fortunately, Ubuntu allows you to change the default applications associated with different file types.
Method 1: Using Terminal Commands
One of the easiest and quickest ways to change file associations is by using terminal commands.
For Ubuntu 13.04 and Later
To update the file
/etc/gnome/defaults.list, use the following command:
sudo sed -i 's/gedit.desktop/sublime-text-2.desktop/g' /etc/gnome/defaults.list
In this command,
sudo gives you administrator privileges,
sed is a stream editor for filtering and transforming text,
-i is used for in-place editing of the input file, and
's/gedit.desktop/sublime-text-2.desktop/g' is the sed command that replaces ‘gedit.desktop’ with ‘sublime-text-2.desktop’.
For Pre-13.04 Versions
To change system-wide associations, use the command:
sudo sed -i 's/gedit.desktop/sublime-text-2.desktop/g' /usr/share/applications/defaults.list
To change only your user’s associations, use the command:
sed -i 's/gedit.desktop/sublime-text-2.desktop/g' ~/.local/share/applications/mimeapps.list
Please note that Sublime Text 3 uses
sublime-text.desktop instead of
sublime-text-2.desktop. If you are using Sublime Text 3, modify the commands accordingly.
Method 2: Using Ubuntu Tweak
Another method to change associations is by using Ubuntu Tweak. However, this method is only applicable for Ubuntu versions prior to 16.04.
Steps to Follow
- Install Ubuntu Tweak by following the instructions provided here.
- Open Ubuntu Tweak from the Dash.
- Go to the “Admin” tab.
- Click on the “File type manager” section.
- Select the “Text” category from the left sidebar and sort the applications by name.
- Select the entries with gedit, press and hold the Shift key, and click on the last entry with gedit.
- Click on the “Edit” button.
- Choose the desired application from the list or click on the “Add” button to add a custom application.
- Click “Close” to save the changes.
Changing file associations in Ubuntu is a straightforward process. Whether you prefer to use terminal commands or a GUI tool like Ubuntu Tweak, you have the flexibility to set your preferred applications as the default for different file types. Remember, if you want to reset the associations, you can use the reset button in Ubuntu Tweak.
Please note that the commands and methods provided here are specific to Ubuntu and may not work on other Linux distributions. Always ensure you understand the commands you are running in your terminal and the changes you are making to your system.
Yes, you can change the default text editor for specific file types in Ubuntu. This can be done by changing the file associations for those file types.
To change the default text editor in Ubuntu, you can use terminal commands or a GUI tool like Ubuntu Tweak. The terminal commands involve modifying certain files to update the associations, while Ubuntu Tweak provides a user-friendly interface to make the changes.
Yes, you can use any text editor as the default in Ubuntu as long as it is installed on your system. You can choose from popular text editors like Sublime Text, Atom, or even Vim.
Changing the default text editor will affect the file associations for the specific file types you modify. It will not change the default text editor for all files on your system.
Yes, you can revert back to the default text editor after making changes. In Ubuntu Tweak, you can use the reset button to restore the default associations. If you used terminal commands, you can modify the files again to set the associations back to the default values.
Yes, the methods provided in this article are specific to Ubuntu. They may not work on other Linux distributions. It’s always important to ensure compatibility before making any changes to your system.