Ubuntu

Install and get started with Sublime on Ubuntu 20.04

Sublime Text is a powerful and extensively used text editor that offers everything that you will need as a programmer or a developer. It is a very robust and efficient text editor supported on all major platforms Windows, Linux, and MacOS. It is written explicitly for editing codes. It supports a ton of shortcuts that makes the work faster along with a lot of functionalities including syntax highlighting, language compiler, quick navigation, distraction-free mode, and much more.

This article will explain how to install and get started with Sublime on Ubuntu 20.04 LTS system. We will be using the command line Terminal for installing Sublime Text code editor. The Terminal can be opened using the Ctrl+Alt+T keyboard shortcut.

Note: In order to install or remove any software from your system, you must have sudo privileges.

Installing Sublime Text Code Editor

Sublime Text is not available in the official repositories of Ubuntu, so we will need to manually add its PPA repository to the sources.list file in our system.

Step 1: Downloading Sublime Text Repository key

Before adding the repository for Sublime Text, the first step would be to add its public key. It is added to ensure the package we are going to install is from authenticated sources.

Issue the following command in Terminal to download the public key for Sublime Text repository:

$ wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg

Step 2: Adding Sublime Text Repository key

Now add this public key to the list of trusted keys as follows:

$ sudo apt-key add sublimehq-pub.gpg

If the output returns OK, it will indicate the key has been added successfully.

Step 3: Adding Sublime Text repository

In the step, we will be adding the Sublime Text PPA repository to the list of sources using the add-apt-repository command. Sublime Text has 2 main release channels; Stable and Dev. Stable release as the name implies is a verified and reliable version of the Sublime Text. The Dev release although have more features and functionalities than the Stable release, but is unstable and contains bugs.

To add the repository for stable release, the command would be:

$ sudo add-apt-repository "deb https://download.sublimetext.com/ apt/dev/"

To add the repository for the Dev release, the command would be:

$ sudo add-apt-repository "deb https://download.sublimetext.com/ apt/dev/"

We have added the repository for the Stable release of Sublime Text.

Step 4: Updating repository index

After adding the Sublime Text repository to the list of sources, we will need to update the repository index. You can update the list of sources as follows:

$ sudo apt-get update

Step 5: Installing Sublime Text

Once the repository is updated with the Sublime Text PPA, the next step is to install it as follows:

$ sudo apt install sublime-text

Step 6: Launching Sublime Text

Once installed, Sublime Text can be launched either via Command Line or via UI. To launch Sublime Text via Command Line, simply type subl in Terminal:

$ subl

To launch Sublime Text via UI, hit the super key on your keyboard and type Sublime Text in the search bar. Click the Sublime Text icon from the search result as follows:

Once launched, you will see the following default view of the Sublime Text:

Removing Sublime Text

In case, you want to remove Sublime Text for your system, you can do so with the following command in Terminal:

$ sudo apt remove sublime-text

Getting Started With Sublime Text

Following are some useful information and shortcuts that will you need to get started with Sublime text:

Select theme and color scheme

You can choose a theme and color scheme to change the default appearance of Sublime Text. Hit Ctrl+Shift+P and type theme, and then select a theme according to your preferences.

Add folders to Project

You can add folders containing the data related to your project. To add a folder, go to Project > Add Folder to Project from the toolbar at the top.

Package Control

Although Sublime Text already comes with a lot of functionalities, still you can enhance the functionalities by adding third party plug-ins and packages. With the help of Package Control, you can easily install and manage these plug-ins and packages. In order to install Package Control, hit Ctrl+Shift+P, then type Install Package Control and press Enter.

Goto File

File navigation is super easy in Sublime Text. From the top toolbar, use the shortcut Ctrl+P and search for any file name in your project.

Go to anywhere

Hit Ctrl+R to go to any function or symbol in the current file.

Enter distraction free mode

Use Shift+F11 to enter into distraction-free mode with no sidebars, top menu bars, minimap, and status bar.

Word Selection

Word selection lets you select all the occurrences of the word under your cursor. Place your cursor on a specific word, then hit Ctrl+D. By doing so, the current word will be selected. Now if you again hit the Ctrl+D, it will enter into multimode selection and select other instances of the same word in the document.

Sublime Text is full of powerful features and shortcuts; you will have to learn and practice to grasp full command on it. This article is a good place to start with for those who are learning Sublime Text for the first time. It will help you to install and get started with Sublime Text on a Ubuntu 20.04 LTS.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.