How to Install and Set Up Sublime Text on Linux

How to Install and Set Up Sublime Text on Linux

Sublime Text is a source code editor that supports various markup and programming languages. It offers features like command palette, goto anything, auto-completion, snippets, and plugins, among others, and works on all major platforms, including Linux, macOS, and Windows.

If you, too, are a Sublime Text user and your recent switch to Linux has you missing the editor, or you’re just getting started with programming and wish to try out a new code editor, you’ll want to get Sublime Text running on your Linux machine.

To make things easier, here’s a guide with step-by-step instructions to install Sublime Text on Linux.

Install Sublime Text Using a Package Manager

Sublime Text is available on most Linux distros via their respective package managers. If you’re running Ubuntu, Arch Linux, CentOS, Fedora, or openSUSE, you can follow the instructions in the sections below to install Sublime Text on your machine.

Installing Sublime Text on Ubuntu/Debian

Running Ubuntu or its derivatives means you can use the APT package manager to install programs, and that’s what we’ll use to install Sublime Text too.

For this, first, open the terminal. Now, enter the following command to add the GPG key:

wget -qO - | sudo apt-key add -

Add the Sublime Text repository to the system with:

echo "deb apt/dev/" | sudo tee /etc/apt/sources.list.d/sublime-text.list


Finally, update the APT sources and install Sublime Text by entering:

sudo apt update
sudo apt install sublime-text

If you wish to remove Sublime Text from your system, run:

sudo apt remove sublime-text

Installing Sublime Text on Arch Linux

On Arch Linux, you can install Sublime Text using pacman. For this, start by adding the GPG keys. You can do this using the following command:

curl -O && sudo pacman-key --add sublimehq-pub.gpg && sudo pacman-key --lsign-key 8A8F901A && rm sublimehq-pub.gpg

Then, add the repository by running:

echo -e "
Server =" | sudo tee -a /etc/pacman.conf

Once it’s added, update the repository and install Sublime Text with:

sudo pacman -Syu 
sudo pacman -S sublime-text

To delete Sublime Text, run:

sudo pacman -R sublime-text

Installing Sublime Text on CentOS

CentOS uses YUM, which simplifies the package installation process on the system. To install Sublime Text with YUM, first, add the GPG keys using the following command:

sudo rpm -v --import

Now, add the Sublime Text repository with:

sudo yum-config-manager --add-repo

And finally, run the commands below to install Sublime Text:

sudo yum update
sudo yum install sublime-text

In case you no longer want to use Sublime Text, you can delete it from your computer with:

sudo yum remove sublime-text

Installing Sublime Text on Fedora

On Fedora, you can install and manage packages using DNF. To install Sublime Text, first, run the command below in the terminal to add the GPG key:

sudo rpm -v --import

Then, add the repository for Sublime Text with:

sudo dnf config-manager --add-repo

Once it’s added, update the package list and install Sublime Text by running:

sudo dnf update
sudo dnf install sublime-text

For removing Sublime Text, run:

sudo dnf remove sublime-text

Installing Sublime Text on openSUSE

Installing Sublime Text on openSUSE is made easy thanks to the Zypper package manager. To do this, first, run the command below to add the GPG key:

sudo rpm -v --import

Next, add the Sublime Text repository with:

sudo zypper addrepo -g -f

And lastly, update the package list and install Sublime Text by running:

sudo zypper update
sudo zypper install sublime-text

At any point, if you want to remove Sublime Text from your system, use:

sudo zypper rm sublime-text

How to Install Sublime Text Using Snap

While the package manager installation method covers most Linux distros, in case you’re using a distro other than the ones mentioned in the previous section—or if you’re facing issues with installing Sublime Text using a package manager—you can use Snap for the installation instead.

But before you can install Sublime Text via Snap, you must first install and set up Snap on your computer.

In case you’re uncertain whether Snap is installed on your system, you can verify this by running:


If this outputs the Snap description, it indicates that Snap is present on your system, and so you can skip the installation and move on to the next step. In case it doesn’t, follow our detailed guide on Snap to learn how to do this.

Once you’ve successfully set up Snap, open the terminal and run the following command to install Sublime Text:

sudo snap install sublime-text --classic

To remove Sublime Text, run:

sudo snap remove sublime-text --classic

How to Set Up Sublime Text

Considering you’ve followed the instructions for your Linux distro carefully, you should have Sublime Text successfully installed on your machine.

To launch it, access the applications menu and search for Sublime Text. Click on the most relevant result or hit Enter.

Sublime Text first run on Linux

Now, before you jump in and start using the program to write/edit code, there are a few things you should do for a better experience.

To begin with, if you’ve been a Sublime Text user—up to version 3—and you used minimap to navigate through a file effortlessly, you’d notice that the latest version (Sublime Text 4) doesn’t have the option enabled by default.

However, there’s a way to enable it. To do this, click on Preferences and select Settings. In the Preferences.sublime-settings file, add the following line between the curly brackets ({}):

"always_show_minimap_viewport": true,

enabling minimap viewport in Sublime Text

Hit Ctrl + S or go to File > Save to save the changes.

As soon as you save the file, you’ll notice that the minimap viewport is back and fully functional on Sublime Text 4.

Similarly, if you’d like to use a fixed font size for all your files, you can add the following line to the same file to avoid having to change the font size for each file again and again:

"font_size": 14,

You can also set tab size if that’s something that bothers you by adding:

"tab_size": 2,

Or, translate tabs to spaces using:

"translate_tabs_to_spaces": true,

Another important feature you must enable (install rather) is Package Control, which makes it easier to find, install, and keep packages updated on the app.

To install Package Control, click Tools > Install Package Control. Sublime Text will now take a few seconds and automatically install it for you.

installing Package Control in Sublime Text

Bring up Command Palette by pressing Ctrl + Shift + P, and then search “package control” in the search window. This will show you all the various Package Control options that you can use to carry out different operations.

One such operation is installing packages, which we’re going to use to integrate Git into Sublime Text to simplify file management between your local computer and remote repositories. (If you have Git installed on your system, you can skip this.)

For adding Git, press Ctrl + Shift + P to invoke Command Palette. Here, start typing “package control” and select Package Control: Install Package.

installing Git with Package Control on Sublime Text

On the following screen, click on the search window and type Git. Click the result that reads Git to install it.

installing Git with Package Control on Sublime Text

Once Git is installed, you’ll find it under Tools. Do note that you’ll need to set it up before you start using it.

Related: How to Install and Configure Git on Linux

Write Efficient Code on Linux Using Sublime Text

With Sublime Text installed and configured on your Linux computer, you should now be able to use it to write code in various programming languages efficiently.

Moving forward, as you start using the editor for your work, you’ll find the need to install additional packages to simplify certain operations. Thanks to Package Control, you can now do this easily and enhance Sublime Text’s functionality to your needs.

If you’d like to explore more options, you may want to check out some other IDEs and code editors for Linux.

Editing Code in Code Editor or IDE
The 10 Best IDEs and Code Editors for Linux

Developers often prefer Linux over other OSes due to the stability it offers. Here are some free-to-use code editors and IDEs you can use on Linux.

Read Next

About The Author

Original Link

Leave a Comment

Your email address will not be published.

Scroll to Top