How to Install Sublime Text editor 4 on Ubuntu 22.04

Sublime Text editor 4 is a cross-platform and open-source application used to write, edit, and run code in various languages. Sublime Text editor 4 introduced new features that make it unique from the previous versions. For example, multi-tab selection, auto-complete context-aware, GPU rendering, and many more.

This article will provide you with deep insight and knowledge to learn the various methods to install Sublime Text editor 4 on Ubuntu 22.04.

Method 1: How to Install Sublime on Ubuntu 22.04 Using Sublime’s Repository?

Ubuntu does not include Sublime packages in its official repository. However, you can install Sublime on Ubuntu 22.04 by adding Sublime’s repository. For this purpose, follow the procedure one by one:

Step 1: Add Sublime GPG key

The GPG key imports the Sublime text editor from an authentic source. For this purpose, use the following command:

$ wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo gpg --dearmor -o /usr/share/keyrings/sublimetext-keyring.gpg

The GPG key was added successfully.

Step 2: Add Sublime Repository

For installation of the sublime text editor on Ubuntu 22.04, you should add the sublime repository. For this purpose, run the following command:

$ echo "deb [arch=amd64 signed-by=/usr/share/keyrings/sublimetext-keyring.gpg] https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list

The Sublime repository was imported successfully.

Step 3: Update System Packages

To update the core repository of the system, execute the following command:

$ sudo apt update

The systems repository is updated.

Step 4: Install the Sublime Text Editor

For installation of the Sublime Text editor 4, execute the following script:

$ sudo apt install sublime-text

The output showed that sublime Text editor 4 has been installed.

How to Launch Sublime on Ubuntu 22.04?

After the successful installation of Sublime Text editor on Ubuntu 22.04, click on  “Activities” and go to the “search bar”:

Write “sublime” in the search bar to find the application (Sublime Text):

To execute the Sublime Text editor, click on it:

The Sublime Text editor is open now. You can write, edit, and save code in the Sublime Text editor.

How to Remove Sublime Text Editor 4 From Ubuntu 22.04?

If you install Sublime Text editor using APT package manager, you can remove/uninstall it from Ubuntu 22.04 using the following command in the terminal:

$ sudo apt autoremove sublime-text

The “autoremove”command removes all the dependencies and unused files along with Sublime.

Method 2: How to Install Sublime Text Editor on Ubuntu 22.04 Using Snap?

A Snap is a software package that downloads the complete archive and dependencies of an application. Snap is backed up by a service named snap which comes by default in Ubuntu 22.04. You just need to install Sublime Text editor 4 on Ubuntu 22.04 by utilizing the below script:

$ sudo snap install sublime-text --classic

Sublime Text is installed successfully.

For verification, run the below-mentioned script in the terminal:

$ subl --version

It is verified that the installed version of the Sublime Text editor is “4126”.

How to Remove the Sublime Text Editor from Ubuntu 22.04 Using Snap?

If you have installed the Sublime Text editor on Ubuntu 22.04 using Snap, you can remove it with the help of the following snap command:

$ sudo snap remove sublime-text

The output shows that Sublime Text was successfully removed from Ubuntu 22.04.

Congratulations! You have learned the installation methods of Sublime Text editor 4 on Ubuntu 22.04.

Conclusion

The Sublime Text editor 4 can be installed by importing the Sublime repository or using the Snap-on Ubuntu 22.04. This article has demonstrated possible methods to install Sublime Text editor 4 on Ubuntu 22.04. The Sublime Text editor is used to write, edit, and save the codes of several languages. Apart from installation, the removal methods of Sublime 4 are also explained.