sudo visual studio code code example
Example 1: open vscode in terminal sudo
sudo code --user-data-dir="~/.vscode-root"
Example 2: install vscode ubuntu command line
sudo snap install --classic code
sudo code --user-data-dir="~/.vscode-root"
sudo snap install --classic code