vscode command not found - Ubuntu

Page content

How to Install vscode Command on Ubuntu

If you are using Ubuntu and trying to install the vscode command, you may encounter the error “vscode command not found”. This is because vscode is not a built-in command in Ubuntu.

What is vscode?

vscode is a popular source-code editor developed by Microsoft for Windows, Linux, and macOS. It provides features like debugging, syntax highlighting, intelligent code completion, snippets, and code refactoring.

Installation Steps

To install vscode on Ubuntu, follow these steps:

  1. Download Visual Studio Code: Visit the official website and download the .deb package for Ubuntu.

  2. Install Visual Studio Code: Once the download is complete, navigate to the directory where the .deb file is saved and run the following command to install vscode:

    sudo dpkg -i <file_name>.deb
    
  3. Launch Visual Studio Code: After the installation is complete, you can launch vscode by searching for it in the application menu or by running the following command in the terminal:

    code
    
  4. Set Up Command Line Shortcut: To be able to launch vscode from the command line, you can set up a symbolic link by running the following command:

    sudo ln -s /usr/share/code/bin/code /usr/bin/code
    

Now you should be able to run the vscode command in your terminal and open the Visual Studio Code editor.

Compatibility with Ubuntu

If the above commands are not compatible with your Ubuntu system, you can try the following alternative steps:

  • Snap Package: You can install vscode via the Snap package manager by running the command sudo snap install code --classic.

  • PPA Repository: If you prefer to install from a repository, you can add the Visual Studio Code repository by running the commands:

    curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
    sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
    sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
    sudo apt-get update
    sudo apt-get install code
    

By following these steps, you should be able to successfully install and use the vscode command on your Ubuntu system.

Conclusion

In this tutorial, you learned how to install the vscode command on Ubuntu and different methods to ensure compatibility with your system. Visual Studio Code is a powerful tool for developers, and having the command line shortcut makes it even more convenient to use. Happy coding!