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:
Step 2: Adding Sublime Text Repository key
Now add this public key to the list of trusted keys as follows:
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:
To add the repository for the Dev release, the command would be:
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:
Step 5: Installing Sublime Text
Once the repository is updated with the Sublime Text PPA, the next step is to install it as follows:
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:
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:
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.
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.
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 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.