10

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
Angelo Dias
  • 1,125
  • 4
  • 13
  • 23
  • Martin's answer worked. I didn't want to add more things to my .zshrc though. Reinstalling and installing VS Code through the Pop Shop fixed the issue. – Finn Feb 19 '21 at 03:19

5 Answers5

13

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).

Ivan Carcamo
  • 504
  • 4
  • 8
  • Thank you! That also worked for me running Pop Os 20.04 LTS – jvbs Apr 19 '21 at 00:51
  • 1
    The `cd` is superfluous as such; `ln -s /usr/share/code/bin/code /usr/local/bin` from anywhere in the file system. Perhaps see also [What exactly is current working directory?](https://stackoverflow.com/questions/45591428/what-exactly-is-current-working-directory/66860904) – tripleee May 18 '23 at 16:31
5

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"

3

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

sudo snap install code --classic
ismail
  • 181
  • 2
  • 7
2

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

-1

If you are installing from Pop!_Shop confirm if it's deb instead of flatpak.

pebueno
  • 31
  • 2
  • 7
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/34197498) – Rohit Gupta Apr 17 '23 at 02:11