Install Sublime Text 2 in Ubuntu 12

Source: Internet
Author: User
Document directory
  • Download
  • Extract
  • Run
  • Simplified
Download

Sublime text 2 is http://www.sublimetext.com/2. If the customized Linux system is 64-bit, do not forget to download the 64-bit package. The speed and performance are very different.

Extract

You can use the GUI management tool to decompress the package. However, we recommend that you use the command line tool. Open terminal <CTRL + ALT + T>, and first enter the folder where the downloaded package is stored: (assume it is the downloads folder under the user directory)

~$ cd ~/Downloads/

Decompress the downloaded package:

Downloads$ tar -xf Sublime\ Text\ 2.0.1\ x64.tar.bz2

.tar.bz2In this way, the suffix file can be treated.zipFile;\It is an escape character. It is used to compress spaces in the file name, so that it will not be mistakenly treated as a Separator by the command.

Run

Go to the decompressed folder, and we can see the file consisting of sublime text 2, and run the following command to run it:

SublimeText2$ ./sublime_text

However, there are two other issues worth noting:

  • Where should applications be stored?

First, Linux systems such as Ubuntu do not require users to store their applications in a fixed place. However, there are usually the following solutions to choose from:

  1. Save in/usr/lib/Or/usr/local/lib/Folder

  2. Save in/opt/Folder

  3. Save in~/apps/Or similar user-defined folder

All these solutions are acceptable. The most important thing is to develop a habit and never let it go. Suppose we choose/usr/local/libFolder, so we can enter:

SublimeText2$ cd ..Downloads$ mv Sublime\ Text\ 2/usr/local/lib/
  • Why should I add./What about it?

In Linux, there is an environment variable called$PATHThe system saves the paths where executable binary files are stored. Therefore, you can run these commands anywhere without specifying their absolute paths.

You can enter the following command to view$PATHEnvironment variable:

$ echo $PATH

In the previous example,~/Downloads/Sublime Text 2/The folder is not$PATHEnvironment variable, so even in this path, it cannot be directly executedsublime_textThis command, so we need to add./(Equivalent to the current directory.

But isn't it very troublesome? Do you have to add the folder path of an application$PATHIs it possible to run it in a variable? Of course not.

ImagelscdpwdSuch commands can be run anytime, anywhere, because they are stored in/bin/Or/sbin/Folder.$PATHEnvironment variable. Similarly,/usr/bin/Andusr/sbin/This is also true. However, we didn't put all the files of sublime text 2 in these folders, because they are not all executable binary files. We can do this:

$ ln -s /usr/local/lib/Sublime\ Text\ 2/sublime_text /usr/bin/subl

This command is for executablesublime_textA file namedsubl(Similar to the shortcut in windows, but only run in the command line), and save it in/usr/bin/Folder. Therefore, we can entersublTo run sublime text 2.

Simplified

Through the above operations, we have installed the Linux version of sublime text 2, but this is too much trouble compared to Windows or Mac OS X. Can we create a graphical shortcut so that we can run it in Ubuntu dash or launch bar?

Of course you can! First, let's enter a folder:

$ cd /usr/share/applications/

Here we use Sublime Text 2 to create an object:

$ subl sublime.desktop

.desktopA suffix file is like a shortcut in the graphic interface. You can search or run it through Dash, or lock it on the Launch Bar. The following content must be entered in this file:

[DesktopEntry]Version=1.0Name=SublimeText2GenericName=TextEditorExec=sublTerminal=falseIcon=/usr/local/lib/SublimeText2/Icon/48x48/sublime_text.pngType=ApplicationCategories=TextEditor;IDE;DevelopmentX-Ayatana-Desktop-Shortcuts=NewWindow[NewWindowShortcutGroup]Name=NewWindowExec=subl -nTargetEnvironment=Unity

Note:The path specified by row 7th determines whether the shortcut displays the icon correctly. Do not enter an error.sublThat is the connection you created earlier. If the name of the connection you created is different, do not forget to change it correctly.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.