Skip to main content

Visual Studio Code (VS Code) allows you to manage extensions using the VS Code Command Line Interface (CLI) called code. With the code CLI, you can install, list, uninstall, and manage extensions from the command line.  

To check you have the code prompt running, run

code --version

Response you're looking for is


If not, to install, in VS Code press command + shift + p to open the command palette, then type "install code", click Shell command: Install 'code' command in PATH.  In terminal, type code YOUR_FILENAME` to open that file in VS Code.

Common commands for managing extensions using the code CLI:

Install an Extension

To install an extension from the command line, use the --install-extension flag followed by the extension's unique identifier. For example:

code --install-extension publisher.extension-name

Replace publisher.extension-name with the actual identifier of the extension you want to install.

List Installed Extensions

To list all the installed extensions, use the --list-extensions flag:

code --list-extensions

This command will display a list of installed extensions.

Uninstall an Extension

To uninstall an extension, use the --uninstall-extension flag followed by the extension's unique identifier:

code --uninstall-extension publisher.extension-name

Replace publisher.extension-name with the identifier of the extension you want to uninstall.

Update Extensions

You can use the --force flag with the --install-extension flag to force the update of an extension to the latest version. For example:

code --install-extension publisher.extension-name --force

This will update the specified extension to the latest available version.

Install Extensions from a List

You can also install multiple extensions listed in a text file. Create a text file that contains a list of extension identifiers, one per line. Then, use the --install-extension flag with the --force option to install them. For example:

cat extensions.txt | xargs -L 1 code --install-extension --force

This will install all the extensions listed in the extensions.txt file.  Remember that the code CLI needs to be in your system's PATH for these commands to work. Additionally, you can automate extension management by scripting these commands if you have a specific set of extensions to manage across multiple installations of VS Code.

Related articles

Andrew Fletcher06 May 2024
Exploring historical memory usage monitoring with Sysstat
In the realm of system administration and monitoring, understanding memory usage trends is crucial for maintaining system health and performance. While tools like htop offer real-time insights into memory usage, they lack the capability to provide historical data. So, what if you need to analyze...