Guides 11792 Published by

The tutorial shows how to add the official Sublime repository, import its GPG key, and create a source list file so Ubuntu can locate the package. It then updates apt’s cache, installs the stable Debian build, verifies the install with subl -v, and offers optional Snap or Flatpak alternatives for those who prefer isolated environments. The guide also explains setting Sublime as the default editor through update-alternatives and notes that future upgrades are handled by Sublime’s own Package Control system. Finally, it suggests launching Sublime from any directory with subl . to confirm that files open instantly and syntax highlighting works.



How to Install Sublime Text 4 on Ubuntu 22.04 LTS

Sublime Text 4 offers lightning‑fast editing and a slick UI that many developers find easier than the default Gedit or VS Code.
If you’ve been stuck with sluggish text editors after a recent kernel upgrade, this guide shows how to get Sublime up and running on Ubuntu 22.04 in minutes.

Add the official Sublime repository
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -

Why this matters: The key lets your system trust packages from Sublime’s servers, preventing a “Package not signed” error when you try to install.

Create the repository file:

echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublimetext.list

Why this matters: Ubuntu pulls packages from defined lists; adding Sublime’s repo tells it exactly where to look.

Update and install
sudo apt update
sudo apt install sublime-text

The update step fetches the latest package list, ensuring you get the newest Sublime 4 build.
If you’re on a 64‑bit machine (most people are), this will pull the correct binary automatically.

Verify the installation
subl -v

You should see something like Sublime Text 4.x.y. If the command is unknown, double‑check that /opt/sublime_text was added to your PATH by the installer.

(Optional) Install via Snap or Flatpak

Some users prefer isolated package formats. For Snap:

sudo snap install sublime-text --classic

For Flatpak (requires Flathub):

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install flathub com.sublimetext.three

These alternatives can be handy if you want to keep Sublime separate from the rest of your system, but they might lag behind the official Debian package.

Set Sublime as the default editor (optional)

If you’re comfortable with terminal defaults:

sudo update-alternatives --config editor

Choose the entry that points to subl. Now commands like nano or vim‑less workflows will open Sublime instead.

Keep it fresh

Sublime uses a bundled package control system. To upgrade in the future, simply restart Sublime and let Package Control pull the new releases.

Quick sanity check

After installing, launch Sublime with:

subl .

in any directory to open that folder’s contents. If files open instantly and syntax highlighting works, you’re all set.

That’s it—Sublime Text 4 is now on your Ubuntu 22.04 machine, ready for rapid coding or quick note‑taking.