VS Code code command not working anymore on terminal on Pop OS

Viewed 16905

I know this is a common asked question. I've searched and the answers didn't help, as many of them are for OSx and WSL. I'm on Pop!_OS.

I'm a VS Code user and I'm used to type code . to open my current folder on VS Code. But as of today, this doesn't happen anymore.

code . = command not found

The many answers I found tell me to ctrl+shift+p on VS Code and type install to find a command that installs the shell. It's not available for me.

vscode printscreen showing aforementioned explanation

Specs:

  • Pop!_OS 20.04 LTS x86_64
  • VS Code 1.53.2
  • zsh 5.8 (x86_64-ubuntu-linux-gnu) + Oh My Zsh
4 Answers

In my case, I created a symbolic link.

$ cd /usr/local/bin/
$ sudo ln -s /usr/share/code/bin/code code

from there on I could use code from wherever in the terminal (I also use Pop OS).

I was having the same issue and I am guessing the installation directory of VScode was moved during the VScode update (I think that's when it stopped working for me). Anyway, this is what I added to my .zshrc file to make it work:

export PATH="/usr/share/code/bin:$PATH"

I added export PATH="/usr/share/code/bin:$PATH" to .bashrc and restarted Terminal and it worked for me.

I was having the same issue so I uninstall vscode and install it using snap:

sudo snap install code --classic
Related