How to Install Sublime Text 4 on Ubuntu Linux 24.04, 22.04 or 20.04

This guide will demonstrate how to install Sublime Text 4 on Ubuntu 24.04, 22.04, or 20.04 LTS Linux releases using the command-line terminal and Sublime’s official APT repository for the latest version and quick, easy upgrades in the future.

Sublime Text 4 is the latest iteration of the highly popular, sophisticated text editor known for its speed, flexibility, and powerful features. Designed to enhance productivity and support a wide array of programming languages, it stands out for its sleek interface, customizable settings, and extensive plugin ecosystem. Ideal for developers, writers, and anyone in between, Sublime Text 4 offers a seamless experience that adapts to your workflow, whether you’re coding, taking notes, or marking up text.

Key Features of Sublime Text 4:

  • Enhanced Performance: Faster loading times and improved responsiveness make working on large files and projects a breeze.
  • Rich Customization: Tailor the editor to your needs with customizable themes, key bindings, and snippets.
  • Powerful Syntax Highlighting: Automatic language detection and rich color schemes provide a clearer view of your code.
  • Cross-Platform Support: Works seamlessly on Linux, Windows, and macOS, ensuring a consistent experience regardless of your OS.
  • Advanced Code Navigation: Features like Goto Definition and Goto Anything simplify code exploration and editing.

Moving into the technical details, let’s dive into the process of installing Sublime Text 4 on your Ubuntu system without further ado.

Install Sublime Text 4 on Ubuntu via APT

Update Ubuntu System Packages Before Installing Sublime Text 4

Prepare your Ubuntu system for Sublime Text 4 installation by updating the system’s software packages. This step ensures all existing packages are up to date, reducing potential conflicts and compatibility issues with the new installation. Run the following command in the terminal:

sudo apt update && sudo apt upgrade

This command combines sudo for administrative privileges, apt update to refresh package lists, and apt upgrade to update all installed packages to their latest versions.

Install Initial Packages for Sublime Text 4

Sublime Text 4 depends on certain packages to function correctly. Although these dependencies might already be installed on most Ubuntu systems, verifying and installing any missing ones ensures a smooth installation process. Execute the command below:

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

This installs software-properties-common for managing software repositories, apt-transport-https for secure package downloads, and curl along with ca-certificates for handling secure web connections.

Add Sublime Text 4 APT PPA on Ubuntu

Incorporating Sublime Text 4 into Ubuntu requires adding its official APT repository via a PPA (Personal Package Archive). Start by importing the GPG key for secure installation with this command:

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

Next, add the Sublime Text repository to your software sources:

Option 1: Import Sublime Text 4 Stable (Recommended)

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

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

Note: Adding both repositories will prioritize the developer version during installation.

Update Package Index and Install Sublime Text 4

After adding the Sublime Text repository, update the APT package index to recognize the new additions. Run the following command:

sudo apt update

With the system updated, install Sublime Text 4 using:

sudo apt install sublime-text

This installs the latest version of Sublime Text 4. Verify the installation by checking the version:

subl --version

Launching Sublime Text 4 on Ubuntu

Opening Sublime Text 4 from the Terminal

After successfully installing Sublime Text 4, you can initiate it directly from the terminal. This approach is especially useful when you’re working in the terminal and need to access the editor without interrupting your workflow. Execute the command below to open Sublime Text 4:

subl

This command instantly launches Sublime Text 4, providing a swift transition from command-line operations to graphical text editing.

Starting Sublime Text 4 through the Graphical User Interface

For those who prefer using Ubuntu’s graphical interface, Sublime Text 4 can also be launched via the desktop environment. Navigate through the application menu using the following path:

Applications > Search > Sublime Text.
Launch Sublime Text 4 on Ubuntu Linux 24.04, 22.04, 20.04
Click to launch Sublime Text 4 on Ubuntu Linux.

First-Time Tips for Sublime Text 4 on Ubuntu Linux

Now that you have successfully installed Sublime Text 4 on Ubuntu Linux, here are some first-time tips to get you started with the software. These recommendations aim to enhance your productivity, customize your environment, and introduce you to powerful features unique to the Linux installation of Sublime Text 4.

Optimizing Your Workspace

  • Utilize Workspaces: Sublime Text 4 allows you to save and manage projects with ease. Use the Project > Save Project As... option to organize your work into manageable chunks, enhancing focus and efficiency.
  • Split Layouts for Multitasking: Maximize your screen real estate by splitting the editor window. Access View > Layout and choose from multiple layout options to view and edit files side by side.
  • Customize Color Schemes: Tailor the visual appeal of your editor with Sublime’s vast color scheme options. Navigate to Preferences > Color Scheme... and select one that suits your visual preference for better code readability.
  • Adjust Font and Size: Enhance readability by customizing the font size and family. Go to Preferences > Font and adjust according to your comfort level.

Boosting Productivity with Shortcuts

  • Open Files Quickly: Use the Ctrl+P shortcut to access the “Goto Anything” feature, allowing you to quickly navigate to files, symbols, or lines with just a few keystrokes.
  • Master Multiple Selections: With Ctrl+D, you can select multiple instances of the current selection and edit them simultaneously, greatly speeding up repetitive editing tasks.
  • Commenting Code Efficiently: Toggle comments on lines of code with Ctrl+/ for single-line comments and Ctrl+Shift+/ for block comments, streamlining the code documentation process.
  • Navigate Through Code: Use Ctrl+R to jump to symbols within the current file, making it easier to navigate through functions and classes.

Customizing and Extending Functionality

  • Install Package Control: This is a must-do for accessing a wide array of plugins and themes. Install it by opening the console with `Ctrl+“ and pasting the command from the Package Control installation page.
  • Explore Popular Packages: Enhance Sublime Text 4 with packages like Emmet for HTML/CSS, SublimeLinter for code linting, and GitGutter to see git changes inline.
  • Enable Spell Check: For writing or documentation tasks, turn on spell checking by setting "spell_check": true in your user preferences (Preferences > Settings).
  • Customize Key Bindings: Tailor Sublime Text to your workflow by customizing key bindings. Access Preferences > Key Bindings and modify or add shortcuts as needed.

Efficient Code Management

  • Utilize the Built-in Terminal: Execute Linux commands directly within Sublime Text 4 by installing the Terminal package through Package Control.
  • Set Up Build Systems: Automate your build process by configuring custom build systems under Tools > Build System. This is especially useful for compiling code or running scripts directly from the editor.
  • Use Version Control Integration: With packages like Sublime Merge, you can seamlessly integrate Git functionality into your workflow, enabling you to commit, branch, and merge without leaving the editor.
  • Bookmarking Code: Quickly navigate long files by bookmarking important lines with Ctrl+F2. Access your bookmarks easily with F2 to cycle through them.
Sublime Text 4 ready for use on Ubuntu Linux 24.04, 22.04, 20.04
Sublime Text 4 open and ready on Ubuntu Linux.

Managing Sublime Text 4 on Ubuntu

Removing Sublime Text 4

To free up space or replace Sublime Text 4 with another editor, you can easily uninstall it from your Ubuntu system. This step helps maintain a clean system environment and efficiently manage resources.

Uninstall Sublime Text 4 Using APT

To remove Sublime Text 4, execute the command below in your terminal:

sudo apt remove sublime-text

This command instructs the package manager to uninstall Sublime Text 4 from your system.

Deleting the Sublime Text 4 Repository

Following the application’s removal, it’s advisable to delete the repository to avoid unnecessary updates or conflicts. This action is particularly relevant if you plan to switch between Sublime Text’s development and stable versions.

Run this command to delete the Sublime Text repository:

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

This removes the repository list file for Sublime Text from your system’s sources list.

Removing the Sublime Text 4 GPG Key

For users intending not to reinstall Sublime Text and aiming for a complete system cleanup, removing the GPG key associated with Sublime Text’s repository is recommended. This key is used to verify the authenticity of packages from the repository.

To remove the GPG key, execute:

sudo rm /usr/share/keyrings/sublimehq.gpg

Note that this step is optional and should only be performed if you want to eliminate all components related to Sublime Text from your system.

Conclusion

In this guide, we walked through the steps of installing, managing, and optimizing Sublime Text 4 on Ubuntu Linux, ensuring you’re equipped to make the most of this powerful text editor. From initial setup to advanced customization and efficient workflow tips, we’ve covered the essentials to get you started. Remember, the key to mastering Sublime Text 4 lies in exploring its vast array of features and finding the right plugins and settings that suit your development style. As you continue to use Sublime Text, don’t hesitate to tweak and tailor it to your preferences. Happy coding, and may your journey with Sublime Text 4 be both productive and enjoyable!

Leave a Comment


Your Mastodon Instance
Share to...