Install Sublime Text 2 on Ubuntu!

Want to use Sublime Text 2 on the lab machines? This script installs it in your own user directory in about 30 seconds—no root password required! Just copy and paste* this into a terminal window:

Nervous? The script ( will confirm before it does anything.

* How do I paste into the Ubuntu terminal? It’s Ctrl+Shift+V.
   (And from Windows SSH clients? Most likely: Alt+space, Edit»Paste.)

Short link to this page:

Have any questions? Is something not working? Read below!

So, what exactly does this installer do?

  • Installs Sublime Text 2 into ~/.local/share/ on any Ubuntu computer
  • Adds Unity integration, so that a proper icon shows up in the launcher
  • Adds the subl command, which works like the vim or emacs commands (optional)
  • Set it as the default editor when you double-click on a text file (optional)
  • Don’t want to use Sublime anymore? Just run the installer again to uninstall.

Okay, I installed it. How do I use it?

There are a few different ways to run Sublime:

  • Option #1: Click the Ubuntu logo on the top-left corner of the screen to open the apps menu, then search for Sublime Text 2.*
  • Option #2: After doing above, drag the icon into the launcher for a handy shortcut.
  • Option #3: Find a text/code file in the file browser. If you set Sublime Text to the default editor during installation, simply double-click it. Otherwise, right-click the file, then Open With.
  • Option #4: If you chose to install the subl command, you can use it in the terminal the same way you’d use vim or emacs.*

* Sublime has a blurry icon or I can’t find it in the apps menu!

This happens on some accounts right after you install, sorry about that! You’ll have to log out and log back in and it should be fixed forever.

* The subl command doesn’t work!

The command only works on terminals you open after you install, so you need to open a new terminal. Or you can run source ~/.bashrc if you can’t wait. If it still doesn’t work, maybe you didn’t choose to install it during the installation process?

I want to uninstall or choose different installation options.

Just run the installer again.

Will I get in trouble for installing stuff? Do I have to install it every time?

The files this script adds and modifies are all in your user’s home directory, so it is perfectly acceptable. This also means that installing it will not make it available to other users, and that it will remain installed for you until your account is deleted.

Does this mean I can use Sublime over SSH?

You can definitely use this script to install Sublime onto an Ubuntu machine via SSH. However, running Sublime Text itself over SSH is slow and not recommended.

So maybe this isn’t what I'm looking for. What can I use?

If you’re looking for a way to edit files over SSH, try Cyberduck for Mac/Windows or the built-in SFTP functionality in Ubuntu. Then you can install Sublime Text and then set it as the default editor in Cyberduck/Ubuntu. If you use Ubuntu and have root access, see this for a much simpler way to install Sublime Text.

Bugs? More questions? Please tell me! sublime--delete these hyphens and everything between them (this is to prevent spam)

© 2019 Sean Zhu.

Theme based on Cover.