Sublime Text 4 is renowned for its speed, flexibility, and powerful features, making it a top choice for developers and writers alike. Its sleek interface, extensive plugin ecosystem, and customizable settings, Sublime Text 4 enhances productivity across various programming languages and workflows. Whether coding, taking notes, or marking up text, this editor adapts to your needs seamlessly.
Here are some key features of Sublime Text 4:
- Enhanced Performance: Faster loading times and improved responsiveness for large files and projects.
- Rich Customization: Personalize themes, key bindings, and snippets to fit your workflow.
- Powerful Syntax Highlighting: Automatic language detection and vibrant color schemes for better code clarity.
- Cross-Platform Support: Consistent experience on Linux, Windows, and macOS.
- Advanced Code Navigation: Tools like Goto Definition and Goto Anything streamline code exploration and editing.
With the introduction out of the way, let’s explore how to install Sublime Text 4 on Ubuntu 24.04, 22.04, or 20.04 LTS distros using the command-line terminal. The method outlined here will utilize the Sublime Text PPA to ensure you get the latest version.
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 specific 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
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 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
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 working in the terminal and accessing 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.
Managing Sublime Text 4
Removing Sublime Text 4
You can easily uninstall Sublime Text 4 from your Ubuntu system to free up space or replace it with another editor. 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 covered how to install and manage Sublime Text 4 on Ubuntu Linux. We’ve provided the essentials, from setup to advanced customization and workflow tips. Remember, the key to mastering Sublime Text 4 is to explore its features and find the plugins and settings that work best for you. Keep tweaking and tailoring it to your preferences. Happy coding!