Sep 3, 2024 8 min read

How to Install Sublime Text 4 on Ubuntu 22.04

Install Sublime Text 4 on Ubuntu 22.04 with our step-by-step tutorial. It is a text editor known for its speed, flexibility, and plugin ecosystem.

Install Sublime Text 4 on Ubuntu 22.04
Table of Contents

Introduction

Before we discuss how to install Sublime Text 4 on Ubuntu 22.04, let's briefly understand-What is Sublime Text 4?

Sublime Text 4 is a popular text editor known for its speed, flexibility, and extensive plugin ecosystem. Installing Sublime Text 4 on Ubuntu 22.04 allows you to have a powerful coding and text editing environment.

This tutorial will walk you through the installation process, enabling you to harness the full potential of Sublime Text 4.

Advantages

  1. Speed and Performance: Sublime Text 4 is optimized for speed, delivering a smooth and responsive user experience even with large files and complex projects.
  2. Cross-Platform Compatibility: Sublime Text 4 is available for Ubuntu, macOS, and Windows, allowing you to work seamlessly across different operating systems.
  3. Customization: Sublime Text 4 offers extensive customization options, letting you tailor the editor according to your preferences, including themes, color schemes, syntax highlighting, and keybindings.
  4. Powerful Plugin Ecosystem: Sublime Text 4 supports a wide range of plugins, making it easy to extend its functionality and integrate with various tools and workflows.
  5. Command Palette and Productivity Features: Sublime Text 4 includes a command palette, multiple selections, split editing, a powerful search and replace functionality, and other productivity-enhancing features to streamline your coding workflow.

Section 1: Install Sublime Text 4 on Ubuntu 22.04 via APT

Step 1: Update Ubuntu System Packages Before Sublime Text 4 Installation

Begin by preparing your Ubuntu system for the installation of Sublime Text 4. It is essential to update your system’s existing software packages to the latest versions. Keeping your packages up-to-date mitigates potential conflicts and compatibility issues with new software installations. Execute the following command in your terminal:

sudo apt update && sudo apt upgrade

This command utilizes sudo to execute the update with administrative privileges, apt update to refresh the package lists, and apt upgrade to install the newest versions of all packages currently installed on the system.

Step 2: Install Initial Packages for Sublime Text 4 on Ubuntu

Sublime Text 4 requires specific dependencies for proper functioning. Most Ubuntu systems may already have these dependencies installed. However, to ensure their presence and avoid any issues during installation, execute the following command:

sudo apt install software-properties-common apt-transport-https curl ca-certificates -y

Here, software-properties-common allows you to manage the repositories from which software packages are available. apt-transport-https is essential for securely accessing web repositories, transferring data using various protocols, and establishing secure web connections.

Step 3: Add Sublime Text APT PPA on Ubuntu 22.04

To install Sublime Text 4 using the APT manager, a third-party repository or a "PPA" (Personal Package Archive) needs to be integrated. First, import the GPG key, which is essential for secure communication. This can be done using the following command:

curl -fSsL https://download.sublimetext.com/sublimehq-pub.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/sublimehq-pub.gpg > /dev/null

With the GPG key imported, proceed to add the Sublime Text repository to your system’s software sources list using the command:

Option 1: Import Sublime Text 4 Stable (Recommended) on Ubuntu 22.04

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

Option 2: Import Sublime Text 4 Dev Repository on Ubuntu 22.04

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

This command appends the Sublime Text repository address to the system’s software sources list. Note: If you import both, the developer version will be prioritized to be installed.

Step 4: Update Package Index and Install Sublime Text 4 on Ubuntu 22.04

After adding the Sublime Text repository, updating the APT package index is essential to be aware of the new repository and its packages. Execute the following command:

sudo apt update

Now that the system is primed, proceed to install Sublime Text 4 by executing:

sudo apt install sublime-text

This command downloads and installs the latest version of Sublime Text 4 from the repository that was just added.

subl --version

Section 2: Launching Sublime Text 4 on Ubuntu 22.04

Launching Sublime Text 4 from the Terminal on Ubuntu

Now that Sublime Text 4 is installed, it’s time to launch it. One way to open the editor is through the terminal. This method can be beneficial if you are already working within the terminal and want to open the editor quickly. Enter the following command:

subl

Launching Sublime Text 4 via Graphical User Interface on Ubuntu

Sublime Text 4 can also be launched through the desktop environment for a more visual approach. On your desktop, navigate the application menu by clicking "Applications". You can either scroll through the installed applications to find Sublime Text, or use the search bar for quicker access. Type "Sublime Text" in the search bar and click on the application once it appears.

This method is practical when you are not working in the terminal and prefer using the graphical interface for navigation. It’s also a more intuitive way for those who might not be accustomed to working with terminal commands.

Applications > Search > Sublime Text.
Sublime Text 4 Application Icon on Ubuntu 22.04 Linux - Click to Launch

Section 3: Tips for Getting Started with Sublime Text 4 on Ubuntu 22.04

Step 1: Customize the User Interface on Sublime Text 4 and Ubuntu

One of the first things you’ll notice about Sublime Text 4 is its sleek and uncluttered user interface. However, as developers have different preferences, customizing the user interface to suit your needs can enhance your experience. You can modify the theme, color scheme, and font by navigating to Preferences -> Settings and editing the JSON configuration file. For example, to change the color scheme, you could add:

"color_scheme": "Monokai.sublime-color-scheme"

Step 2: Make Use of Distraction Free Mode on Sublime Text 4 and Ubuntu

When coding, staying focused is crucial. Sublime Text 4 provides a Distraction Free Mode that you can access by going to View-> Enter Distraction Free Mode. This mode minimizes UI elements and maximizes the text area, letting you concentrate solely on your code.

Step 3: Utilize Multiple Cursors and Selections on Sublime Text 4 and Ubuntu

Sublime Text 4 on Ubuntu Linux offers multiple cursors and selections, which can significantly increase coding efficiency. Hold the Ctrl key and click different areas to place multiple cursors, or use the Ctrl + Shift + L shortcut to create a cursor at the end of each selected line.

Step 4: Employ the Command Palette on Sublime Text 4 and Ubuntu

The Command Palette is a powerful feature in Sublime Text 4 that provides quick access to almost every function. Press Ctrl + Shift + P to open the Command Palette, and start typing a command or action name. This is especially useful for accessing commands that don’t have a designated keyboard shortcut.

Step 5: Leverage the Goto Anything Feature on Sublime Text 4 and Ubuntu

Navigation is essential, especially when working with large codebases. Sublime Text 4 offers the Goto Anything feature, allowing rapid file switching and navigation to specific lines or symbols. Press Ctrl + P to invoke this feature, start typing to search or navigate through files.

Step 6: Install Package Control and Extensions on Sublime Text 4 and Ubuntu

Extend Sublime Text 4’s functionality by installing Package Control, allowing easy plugins, themes, and extensions to be managed efficiently. To install Package Control, open the Command Palette (Ctrl + Shift + P), type "Install Package Control", and hit Enter. Once installed, you can discover and install many plugins and extensions that cater to your needs.

Step 7: Configure Build Systems on Sublime Text 4 and Ubuntu

Sublime Text 4 lets you configure build systems for different programming languages. This can streamline your workflow by enabling you to compile and run code directly within the editor. Navigate to Tools -> Build System to choose an existing build system or select New Build System to create a custom one.

Step 8: Explore Keyboard Shortcuts on Sublime Text 4 and Ubuntu

Efficiency is key in development, and mastering keyboard shortcuts is one way to save valuable time. Sublime Text 4 boasts a comprehensive set of shortcuts. Familiarize yourself with these by checking the available shortcuts under Preferences -> Key Bindings, and consider customizing them according to your preferences.

Sublime Text 4 Successfully Installed on Ubuntu 22.04 Linux - Application Open and Ready to Use

Section 4: Managing Sublime Text 4 on Ubuntu 22.04

How to Remove Sublime Text 4 from Ubuntu

If you find Sublime Text 4 no longer meets your requirements, or you need to make space for an alternative text editor, removing it from your Ubuntu Linux system is simple. This ensures that you keep your system uncluttered and manage resources effectively.

Remove Sublime Text 4 Application from Ubuntu APT command:

Execute the following command in your terminal to uninstall Sublime Text 4:

sudo apt remove sublime-text

This command communicates with your package manager to remove Sublime Text 4 from your system.

Remove Sublime Text 4 Repository from Ubuntu APT command:

After uninstalling the application, removing the repository from which it was installed is a good practice. This is especially necessary if you are considering switching between the development and stable branches of Sublime Text, or if you want to ensure no conflicts or unnecessary updates from this repository in the future.

Execute the following command to remove the repository:

sudo rm /etc/apt/sources.list.d/sublime-text.list

This command deletes the Sublime Text list file from your sources list, removing the repository.

Remove Sublime Text 4 GPG Key from Ubuntu APT command:

Suppose you are sure that you will not be using Sublime Text again and wish to do a thorough cleanup. In that case, you can remove the GPG key used for verifying the integrity of packages from Sublime Text’s repository.

Execute this command to remove the GPG key:

sudo rm /usr/share/keyrings/sublimehq.gpg
💡
NOTE: Please note that this step is optional and is generally only necessary to ensure that all traces of Sublime Text are removed from your system.

FAQs to Install Sublime Text 4 on Ubuntu 22.04

Can I use Sublime Text 4 for free? 

Sublime Text 4 can be used for free without a license, but a license must be purchased for continued usage and to support the developers.

How do I activate my Sublime Text 4 license?

After purchasing a license, go to Help > Enter License in Sublime Text 4 and enter your license information.

Can I install plugins in Sublime Text 4? 

Yes, Sublime Text 4 supports an extensive range of plugins. You can install plugins using the Package Control package manager.

Is it possible to customize the appearance of Sublime Text 4? 

Yes, you can customize the appearance of Sublime Text 4 by installing themes, color schemes, and icon sets. These can be installed using the Package Control package manager.

How can I open multiple files in Sublime Text 4? 

Use the command-line syntax subl file1.txt file2.txt to open multiple files simultaneously in Sublime Text 4.

Can I work with Git repositories in Sublime Text 4? 

Yes, Sublime Text 4 has built-in Git integration. You can perform various Git operations such as committing, pushing, and pulling directly from the editor.

Does Sublime Text 4 support multiple cursors? 

Yes, Sublime Text 4 allows multiple cursors, enabling you to edit multiple lines simultaneously for increased productivity.

Conclusion

In this tutorial, we have provided comprehensive steps to install and configure Sublime Text 4 on Ubuntu 22.04.

If you have any queries, feel free to ask them in the comments section, and we would be happy to respond to them....

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.