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.bz2
In this way, the suffix file can be treated.zip
File;\
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:
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:
Save in/usr/lib/
Or/usr/local/lib/
Folder
Save in/opt/
Folder
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/lib
Folder, so we can enter:
SublimeText2$ cd ..Downloads$ mv Sublime\ Text\ 2/usr/local/lib/
In Linux, there is an environment variable called$PATH
The 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$PATH
Environment variable:
$ echo $PATH
In the previous example,~/Downloads/Sublime Text 2/
The folder is not$PATH
Environment variable, so even in this path, it cannot be directly executedsublime_text
This 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$PATH
Is it possible to run it in a variable? Of course not.
Imagels
cd
pwd
Such commands can be run anytime, anywhere, because they are stored in/bin/
Or/sbin/
Folder.$PATH
Environment 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_text
A 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 entersubl
To 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
.desktop
A 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.subl
That is the connection you created earlier. If the name of the connection you created is different, do not forget to change it correctly.