Sublime Text is a source code editor by Sublime HQ. Linux users can install Sublime Text Editor on easily on any version of Ubuntu. Like Visual Studio Code, it has built-in support for several programming languages. Furthermore, it has community-built plugins for other functionalities.
Apart from classic code editor functionalities such as highlighting the syntax, Sublime Text has a few unique features that make it an interesting choice for professional programmers. Its features include:
- Search and replace parts of scripting languages and snippets
- Code preview
- Use regular expressions in search and replace.
- Quick text-block editing
- Batch selection
- Emphasis on keyboard shortcuts to open and switch documents.
- Distraction-free mode to edit code on fullscreen
- Various background themes
In this article, you will learn how to install Sublime Text 4 on Ubuntu using the command line. Along the way, we will also cover how to use Sublime Text Editor after installation.
You will need a Ubuntu machine with Sudo access or root privilege for this tutorial. Additionally, you are also required to have an active internet connection and Terminal access.
Install Sublime Text 4 on Ubuntu 22.04
There are various ways to install the Sublime Text Editor on Ubuntu. You can install it from the Snap store or the official Ubuntu repository. This tutorial will be covering both methods in detail.
Install Sublime Text Using the Official Repository
The Sublime Text Editor is available in the official Ubuntu repository. However, the version might be outdated. Hence, to install the latest Sublime Text Editor version, you must get the signing key added to the system first. And before that, you should also install the Transport HTTPS certificates. So let’s get started.
Firstly, update your repository to the latest version. For example:
sudo apt update && sudo apt upgrade
Secondly, install the HTTPS certificate as shown below:
sudo apt-get install apt-transport-https
You should get similar output like this if it is already installed:
Now, to add the GPG or signing key, launch the terminal using the shortcut key “Ctrl + Alt + T”, and type:
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo gpg --dearmor -o /usr/share/keyrings/sublimetext-keyring.gpg
Alternatively, you can run this command:
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/sublimehq-archive.gpg
Linux requires a GPG key to authenticate packages that would be installed in the system. It will download the key from its website, convert it to an unreadable encrypted key, and put it into “
Add the key in the APT repository using the
add command. For example:
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add
The output should look something like this:
Third, create a file and add the Sublime Text repository to the Ubuntu system as shown below:
sudo gedit /etc/apt/sources.list.d/sublime-text.list deb [signed-by=/usr/share/keyrings/sublimehq-pub.gpg] https://download.sublimetext.com/ apt/stable/
Alternatively, you can run both the commands together as well. For example:
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 echo "deb [arch=amd64] https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
The next step is to update your system using the
update command. Specifically, type:
sudo apt update
The output should look something like this:
Till now, we have configured the repository. Lastly, install Sublime Text using the
install command from the APT package manager.
sudo apt install -y sublime-text
The output should be similar to the one shown below. Wait for the installation to complete.
Install Sublime Text from Snap Store
Sublime Text Editor Editor packages are also available at Snap Store. A group of contributors maintains the Sublime Text Editor in Snap packages. You can also download it from there instead of using the official repository. To install Sublime Text from Snap Store, you must refresh the snap store using the
refresh command first. For example:
sudo snap refresh
You should get a similar output as this:
Next, install the Sublime Text Editor as shown below:
sudo snap install sublime-text --classic
And finally you have installed the Sublime Text Editor on Ubuntu.
Launch Sublime Text Editor
Now that Sublime Text Editor is installed, you can launch it from the Activities panel. Go to the Activities panel and search for Sublime Text.
The output should be similar to this:
Alternatively, you can open the terminal by pressing “Ctrl + Alt + T”. Then type:
You should get a similar output as seen below:
Update Sublime Text
To update Sublime Text Editor to the latest version, execute the commands given below:
sudo apt update sudo apt --only-upgrade sublime-text
Alternatively, you can use the Snap Store to update the Sublime Editor. For this step, use the snap
refresh command followed by the name of the software. For example:
sudo snap refresh sublime-text
Uninstall Sublime Text
In case you do not need the code editor anymore, you can uninstall it from the system using the terminal. Use the
remove command to delete this software from the APT package manager. For example:
sudo apt remove sublime-text
Alternatively, to remove Sublime Text Editor using Snap Store, you should execute the command given below:
sudo snap remove sublime-text --classic
And that about it for this write-up. We hope you now know how to install Sublime Text Editor on Ubuntu in two different ways, including how to launch the editor. If you want to find out more about Sublime Text’s plugins, feel free to visit their official page. We hope you found this article useful.
If this guide helped you, please share it.