0

In Ubuntu 20.04, after download from various ways (snap or ubuntu software) the visual studio code text editor, I had not been able to find a way to install the shortcut command line vscode or code.

I used alias by open the current path:

alias c.='(code $PWD &>/dev/null &)'

But since this won't work without the line command code.

I tried the suggestions found here, to open Visual Studio Code and press Ctrl+Shift+P then type >install shell command but I got command not found.

Henry Palacios
  • 101
  • 1
  • 2
  • 2
    If you have a solution to your problem, post an answer please, instead of putting it in the question. That said, the default Ubuntu configuration will add snap commands to the PATH, so if it doesn't, then you must have messed up something. – muru Jul 18 '21 at 02:37
  • Making symlink to /usr/bin/code is bad practice. The better is to make link to /usr/local/bin/code – N0rbert Jul 18 '21 at 08:12
  • I did it @muru, thanks for you suggestions. I may have damaged something in **snap**, but I only had this problem with **visual studio code** with snap. Finally I left the installation I did with **ubuntu software** – Henry Palacios Jul 18 '21 at 23:52

1 Answers1

0

Solution reached:

  • Find vscode_path where is visual studio code installed.
    Suppose that is /snap/code/current/usr/share/code/bin/code
  • Create a symlink from <vscode_path> bin command to /usr/bin
rm -f /usr/bin/code
ln -s /snap/code/current/usr/share/code/bin/code /usr/local/bin/code

The latter would create a code line command to launch from the terminal

Henry Palacios
  • 101
  • 1
  • 2