Ubuntu

How to install and use with Sublime Text on Ubuntu 22.04

Sublime is a robust and extensively used source code editor that provides programmers and developers the platform to write and edit their codes in different languages. It is best known for its speed, user-friendly interface, and extensions making it an ideal choice for a beginner to use this editor.

It includes several notable features like quick navigation to files, Python-based plugin API and more. Further, its functionality can be expanded by installing various plugins.

This guide will demonstrate how to install and get started with Sublime on Ubuntu 22.04.

Install and get started with Sublime Text on Ubuntu 22.04

The installation of Sublime on Ubuntu won’t be a straightforward process because the standard Ubuntu repository doesn’t include the Sublime package. However, you can install this editor by adding the PPA repository so that you then may be able to install the package. The below steps will guide you on how you can install Sublime on Ubuntu.

Step 1: Adding Sublime Repository Key

Before adding a repository, you will first need to add a Sublime repository key so that the installation of the required package will be performed from an authentic source. The following command will be used to add the repository key.

$ sudo wget -O- https://download.sublimetext.com/sublimehq-pub.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/sublimehq.gpg

Step 2: Importing Sublime Repository

After adding the key, you will need to import the Sublime repository in order to download the stable version of a software. The following command is used to import the repository into the Ubuntu list.

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

There are two versions of Sublime; stable and dev. We are installing a stable release here because it doesn’t have any bugs and work’s perfectly fine on Ubuntu. The dev version has the latest features but it won’t be an ideal choice for Ubuntu users as they are in-progress versions.

Still, if you want to use the dev version, you can use the below-mentioned command.

$ echo 'deb [signed-by=/usr/share/keyrings/sublimehq.gpg] https://download.sublimetext.com/ apt/dev/' | sudo tee /etc/apt/sources.list.d/sublime-text.list

Step 3: Update System

After adding the Sublime repository, you will then need to update your system through following command:

$ sudo apt update

Step 4: Install Sublime

After updating your system, you are now good to install the Sublime application through the following command.

$ sudo apt install sublime-text

Step 5: Running Sublime Text

When the Sublime installation is completed, go to the Ubuntu’s application search and find the type the application name and it will appear on the search.

Click on the Sublime application icon to open it on your desktop.

You can also run the Sublime using the “sbl” command in the terminal.

If you want to find the Sublime version, the below command will work in this case.

$ subl --version

Getting Started with Sublime Text

After successfully installing Sublime, it’s now time to get things started. There are different useful features for you to note which you should try out.

1: Change Themes on Sublime

Sublime lets you change and customize themes according to your choice. To do this, go to the “Preferences” tab and choose the “Select Themes” option to change the themes or you can go with the “Customize Themes” option to customize your theme according to your choice.

2: Add Folders to a Project

In Sublime, you can add multiple projects into a folder using the “Add folders to project” option which is available in the “Project” section.

3: Package Control

Package Control allows you to install new packages and update the installed one in order to keep your packages on Sublime well up to date. To install Package Control on Sublime, go to the “Tools” section and click on the “Install Package Control”.

4: Writing a Code in Sublime Text

Now, if you wish to run codes in Sublime, you can easily do this by opening a new file and saving it with a proper name.

In our case, we are running a simple “Welcome” code in Sublime. For that save the file name as “Welcome”.

Now add the following Python code to run it on Sublime.

print("Welcome Linux Users!")

You can add or write any code. This code is to give you an idea how you can run code in Sublime.

After adding the code, go to the “Tools” section and click on the “Build System” option.

Choose a language as Python.

Once language is set. Click on the “Build” option or use Ctrl+B to execute the code.

When you run the code, select Python that appears on the Sublime dashboard as shown in the image below.

This will output the result as shown in the image below.

In this way, you can execute several programming languages codes with ease. Just pick the programming language of your choice and start your professional career with Sublime.

Conclusion

Sublime is a robust source code editor which is full of powerful features. It can run different language codes and is handy, especially for programmers and developers. It’s an excellent program to start your programming journey. The above guide is assisting the individuals in installing Sublime on Ubuntu and once it’s successful, they can begin building their professional programming career.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.