code command not found - Ubuntu

Page content

How to Install code Command on Ubuntu

If you’re missing the code command on your Ubuntu system, don’t worry! Visual Studio Code, often referred to as code, is a popular source code editor developed by Microsoft. In this tutorial, we’ll walk you through the steps to install the code command on Ubuntu.

Installation Steps

  1. Open a terminal window on your Ubuntu system.

  2. Run the following commands to download the Microsoft GPG key and add the Visual Studio Code repository:

    wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
    sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings
    echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" | sudo tee /etc/apt/sources.list.d/vscode.list
    
  3. Update the package list and install Visual Studio Code:

    sudo apt update
    sudo apt install code
    
  4. After the installation is complete, you can now use the code command to launch Visual Studio Code from the terminal.

Compatibility Note

The code command is specifically designed for Visual Studio Code and may not be available by default on all Ubuntu systems. If you encounter any issues with the installation commands provided above, ensure that your system meets the necessary requirements and that the repository URLs are up to date.

Conclusion

By following these steps, you should now have the code command available on your Ubuntu system, allowing you to easily launch Visual Studio Code from the terminal. Enjoy coding with one of the most popular code editors available!