4

I'm fairly new to Ubuntu and I do believe in jumping in head first into issues to learn. I know that I can run some GUI applications with Putty+Xming on headless Ubuntu Server. But I can't run Visual Studio Code My issue is not installing Visual Studio Code. I've installed through zip and through umake. Both with the same result.

user@server:~/tools/web/visual-studio-code$ ls
Code                       libgcrypt.so.11  natives_blob.bin
content_shell.pak          libnode.so       resources   
Credits_43.0.2357.65.html  libnotify.so.4   snapshot_blob.bin
icudtl.dat                 license.txt      ThirdPartyNotices.txt
libffmpegsumo.so           locales

user@server:~/tools/web/visual-studio-code$ Code
No command 'Code' found, did you mean:
Command 'ode' from package 'plotutils' (universe)
Command 'node' from package 'node' (universe)
Command 'node' from package 'nodejs-legacy' (universe)
Code: command not found
user@server:~/tools/web/visual-studio-code$

Anyone know if VS-Code can be opened this way?

Leo Zhu
  • 45

2 Answers2

4

You have to run an execitable from current directory as ./executable where . represent the current directory.

If you are in ~/tools/web/visual-studio-code directory to run the executable Code you have to do two things,

  1. Check if the executable has execution permission. See How to make a file executable?
  2. Run the executable as, ./Code Why do I need to type `./` before executing a program in the current directory?

How to run an executable from current directory without ./ before executiable:

Run the following command in a terminal,

echo "export PATH=$PATH:." >> ~/.bashrc

and run Code from ~/tools/web/visual-studio-code as

user@server:~/tools/web/visual-studio-code$ Code 

How to run an executable from any directory without ./ before executiable:

echo "export PATH=$PATH:$HOME/tools/web/visual-studio-code" >> ~/.bashrc

and run Code from anywhere,

user@server:~$ Code
sourav c.
  • 44,715
1

So long as you've set the execute permissions on a file correctly, you can execute that file from anywhere in your system without having to add the PATH to your $PATH variable.

The method of doing this just involves typing the absolute path to the executable file. In your case:

~/tools/web/visual-studio-code/Code

or

/home/user/tools/web/visual-studio-code/Code

Adding an entry to your $PATH may be useful if it's a command that you'll use very regularly, but beware the fact that any other filename in that directory will have execution attempted if you type it in the command line. So if you typed 'locales' or 'resources' the system may try to execute those files.

Arronical
  • 19,893