0

I recently saw a post where it was mentioned that gui linux apps can work by running an X server outside of bash.

So I tried to make sublime text editor 2 work using this concept but was not able to do so.

Is my bash faulty or is there any other problem?

  • "using this concept" - you will need to tell us what you actually did – steeldriver Aug 5 '16 at 12:49
  • First I downloaded xming from here .. Then I installed sublime text using sudo apt-get command.. Afterwards I typed DISPLAY=:0 subl ......It gave error – humble Aug 5 '16 at 12:51
  • Ubuntu does not provide Sublime Text as a package via apt, are you using Linux Mint? If so, which version? – Michael Tunnell Aug 7 '16 at 1:25
  • I am using bash on ubuntu on windows – humble Aug 7 '16 at 5:33
1

Here are the steps I did to get sublimetext3 working on bash. It's great because like this you can edit files from bash without corrupting them.

install and run VcxSrv for Windows from https://sourceforge.net/projects/vcxsrv/

then on bash:

sudo apt install gimp
sudo add-apt-repository ppa:webupd8team/sublime-text-3 -y
sudo apt-get update
sudo apt-get install sublime-text-installer
DISPLAY=:0 /opt/sublime_text/sublime_text

and you can create a desktop shortcut with this content:

C:\Windows\System32\bash.exe ~ -c "DISPLAY=:0 /opt/sublime_text/sublime_text"

BTW gimp it's an image editor that contains the libraries (gtk) for sublime_text you can also run it typing:

DISPLAY=:0 gimp
| improve this answer | |
  • is there a way that enables me to just write DISPLAY=:0 sublime_text to open it.(I didn't get the create desktop shortcut thing). Also will it work with Xming also because I have Xming installed – humble Aug 9 '16 at 5:10
  • Xming should also work, yes. If you have Xming running in the background (you will see its icon on the system tray) then you can just type DISPLAY=:0 sublime_text on bash and it will open sublime. The important part is the Xming/VcxSrv should be running in order to a window application to appear. – onoma Aug 9 '16 at 12:28
  • DISPLAY=:0 /opt/sublime_text/sublime_text is the correct command if you don't have /opt/sublime_text/ in the PATH variable. – onoma Aug 9 '16 at 12:40
1

Although there may be a better place to make this change, I add the following line to the file /etc/bash.bashrc to make most X11 apps work (after you've installed and started Xming):

export DISPLAY=localhost:0.0

You will have to save the file then close/open bash again for it to take effect. Then run an X-based app.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.