How to Install and Work with Sublime Text in Linux
In this lecture, we're going to walk through how to install the sublime text editor in our Linux environment.
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
Video locked
This video is viewable to users with a Bottega Bootcamp license

Now I'm going to give the caveat here that you do not need Sublime text in order to go through any of my courses. Any popular text editor is going to give you all of the tools that you need in order to build out applications. I feel a lot of times that people spend so much time, especially new developers, spend so much time picking out a text editor when at the end of the day all that you're going to use it for is to type text and type code into files, that's really all it is.

When it comes to picking out the text editor that you want to go with my top recommendation to students and other developers getting into the coding world is to simply experiment with all of the different ones that are out there. And then pick out the one that you like the most, the one that is the most fun, and that you find is the easiest to use. You do not want the text editor getting in the way of what you're trying to do which is to build applications.

So with all that being said I'm using Sublime Text

large

and my personal approach is that for introductory courses I typically go with a tool like Sublime text and then in my more advanced courses I use vim because vim is what I use on a day in and day out basis when I'm personally building out my own applications. And so for this specific course, I'm going to show how to use Sublime text.

Now I'm going to provide this link in the show notes and we'll walk through exactly what we need to do. So we want to use the apt version of this

apt

Install the GPG key:

wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -

Ensure apt is set up to work with https sources:

sudo apt-get install apt-transport-https

Select the channel to use:

Stable

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

Dev

echo "deb https://download.sublimetext.com/ apt/dev/" | sudo tee /etc/apt/sources.list.d/sublime-text.list

Update apt sources and install Sublime Text

sudo apt-get update
sudo apt-get install sublime-text

if we're going and using Ubuntu and this is what we have on our system. And so you can start by just copying the gpg key so this is going to give us a secure install and I'll zoom in here so you can see better and paste this in. Run it and type in whatever your system password is and it looks like everything there worked.

large

Moving down to the next item so we're going to do is sudo apt-get install apt-transport-https. And so this is going to give us the ability to grab sublime but to use it using the secure https protocol. So we're going to copy this paste it in to the terminal and we don't have any errors.

large

Moving down the line we want to use from a channel perspective we want to use the stable version. Feel free to grab the dev version just know that if you do you might run into a few unexpected bugs. So I'm just going to grab stable here

Stable

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

Then let's paste this in, run it and that worked.

large

and now we are very close, we only actually have 2 commands left. So we can type sudo apt-get update. Now, this is not related to sublime this is just going to make sure that we have the latest version of apt-get.

As you can see we have some security items and patches and different things like that have been added.

large

It's interesting if you are relatively new to using Linux the command sudo apt-get update if you run this 5 times a day you will get 5 updates. The Ubuntu system is that large that it's constantly being updated and each one of the packages inside of your system are going to get updates so it's a good thing. You're going to notice in the documentation for pretty much everything when it comes to installation guides will tell you to run this first, just to make sure you're working with the latest version of your system's installation process.

And last but not least let's install Sublime Text so paste this in sudo apt-get install sublime-text, run it and if everything works we should have access to the full application right after this. So this is going out, It's pulling the entire application down, and it is building it on our systems. It would be one thing to have the application that we could just download but because this is Linux you actually need to build it. So you can come up here in search by your computer and now just start typing out Sublime Text, and if everything worked you should now see this application right here.

large

If you click on this, there we go it is working. Now it will say unregistered if you've not registered and paid for it.

large

But I will leave it up to you and your own conscious on if you're wanting to pay for your text editor or not. A couple things that I will say is let me show you how to open up projects because it would be a very helpful thing. If you come up here and click on file and then click on open folder

large

you can then navigate to any project that you create so if you're building a Rails application you can navigate here in the select folder window to wherever you keep your project so I'm going to click here on Jordan and then I have a Rails application right here and if I click open

large

now you can see that I have all of my rails code for the entire application right here

large

and so this is very helpful.

Now I can create a new tab by typing control + c if I type command + s now it gives me the ability to save a new file. I can also run commands such as control + p, this is going to give me the ability to grab any of the files by just typing so if I type gem you can see it finds that we have a file here called gemfile

large

and if I hit enter that's going to open that file up for us

large

and so depending on what course that you are following along with you're going to see me use that command quite a bit because it is much faster to just type control + p than it is to go and open up each one of these directories each time and sometimes if you have a large application you might have to take 5 clicks in order to find what you're looking for whereas the control + p is a fuzzy search and it allows you to search through your entire application very quickly and easily.

Now another feature that you're most likely going to use is find. So what I just did there was control + shift + f and now it'll pull up any of the words that you want to find. So when I typed control + p that allows you to search for filenames. When I type control + shift + f this is going to allow you to find any code in the project. So let me type in spring if I hit enter now, this is going to go throughout every single file and every time the word spring is here it is going to give you a list of it.

large

So if I want to go and see what it looks like in this bin rails file I can just double-click on this and it's going to open up that code file for me.

large

So just in review, we have installed sublime text, we have seen how we can open up a directory, we've seen how we can use the control key to do a fuzzy search for files, and then control + shift + f to find any kind of code inside of a project. And that is how you can install and work with sublime text inside of Linux.

Resources