M BUZZ CRAZE NEWS
// general

How do I open up Sublime text editor in Ubuntu 18.04LTS?

By Gabriel Cooper

I want to open sublime text editor in my ubuntu18.04LTS command prompt to access my work.

1

2 Answers

Simply use subl <filename>?!

To call Sublime Text from a terminal (assuming you are running in an X environment), you can use the subl command, which is a small shell script that executes the following under the hood.

exec /opt/sublime_text/sublime_text --fwdargv0 "$0" "$@"

For the sake of completeness. The goal turned out to be using sublime as the name on the command line. So I suggested using an alias in the shell.

Not all shells may have that facility, but since this is about Ubuntu, chances were that the OP wanted a solution that worked in Bash.

So

alias sublime=subl

would make it available under the desired name. Alternatively alias sublime=$(which subl).

4

You can access sublime-text from command-line in 18LTS or 19LTS by following these steps:

After installing sublime-text, you have to confirm the location of the sublime text using this command:

For 18LTS,

which subloutput---> /usr/bin/subl

For 19LTS,

which subloutput---> /snap/bin/subl

firstly, You need to know where the sublime-text that you installed is located on your computer.

My sublime-text is located here: /usr/bin/subl (for 18LTS)

Then you need to link it to a new path: /usr/local/bin/sublime

Run1. echo $PATH

Expected Output

/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

To link the sublime-text you, use this command ln -s.

You will need administration (sudo) permission to be able to link because you are about to work with system files.

Run using-

secondly, link the original path to a new path like this:

Run2:

sudo ln -s /usr/bin/subl /usr/local/bin/sublime

You will be Required to input password, go ahead and input your password and press ENTER

usr/local/bin/sublime is the new path that the sublime-test could be accessed from.

Thirdly, Navigate to your working area, where you stored the project you are working on. It could be Desktop or documents or any environment.

Run3: cd Documents/test

You can now open sublime-text from the command-line using:

Run4: sublime .

. will open all the files in that environment but to be more specific you can do this:

sublime test

Depending on where you are working from, the Run1. and Run2. would be applicable but the rest will depend on your working environment.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy