VScode in linux


Using VScode in linux though Remote-ssh

Using vscode through Remote-ssh extension is a kind of popular usage of vscode. We could use desktop vscode and connect to server through the extension which also provide many available extension for coding and debugging. But there would be some misunderstanding of the vscode-server running in the server, I would like to give you a brief introduction to use it.

Connect to server

Just follow the instruction in the manual, usually you could connect to the server in a few seconds. But, the first time you login through Remote-ssh, there would be automatically install .vscode-server directory in your $HOME, and it would take you a few minites.

If you have a problem when connecting, it would be the disk limitation in your $HOME. And that could affect your normal usage of the server, so if you have limit of disk usage in $HOME disk, you should firstly set a soft link in your server where you have enough disk storage. ln -s /your/disk/free/path /home/yourname/.vscoder-server and it would help you a lot even if you have enough space to download the .vscode-server, because with time flies, your .vscode-server would be bigger and bigger where the vscode store all of its caches and extensions also downloaded in there.

And there is also an alternative way that you could set in your vscode desktop, and find the setting Remote-ssh:InstallPath, fix it with your hostname and path to install, you would also solve that.

One more thing about linux $HOME

There could be many directory with prefix ., and you should try to control them. Otherwise, they will take over all of your disk of your /home/. For example, .cache directory usually save some zip files contents, it would be disappeared when rebot of the server. But you should watch it out, and clear it when neccessary.

Alternative way to install vscode extensions

Install from a VSIX#

You can manually install a VS Code extension packaged in a .vsix file. Using the Install from VSIX command in the Extensions view command dropdown, or the Extensions: Install from VSIX command in the Command Palette, point to the .vsix file.

You can also install using the VS Code --install-extension command-line switch providing the path to the .vsix file.

code --install-extension myextension.vsix

You may provide the --install-extension multiple times on the command line to install multiple extensions at once.

If you’d like to learn more about packaging and publishing extensions, see our Publishing Extensions article in the Extension API.

Before End

Reminder that, the remote-ssh extension in vscode uses your computer’s OpenSSH to connect the remote server, and you have to make sure the software is normal in your computer. You could use powershell in Windows to check the service is running normally, and if you do own it, also install it through powershell.

If you have a different shell like zsh, the connection from vscode could not be run properly. You need to delete exec zsh in your ~/.ashrc file.


Author: Wulilichao
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source Wulilichao !
  TOC