0

I am working on a remote machine from my command line using ssh. I want to be able to open files in VScode from this ssh'd terminal using the regular "code file.txt" used when opening VScode in my local machine, or when using the VScode integrated terminal.

I have found several answers but none of them work (Is it possible to use the "code" command in SSH'ed terminal to open VS Code on local machine with SSH extension?). After trying several solutions from this answers I still get

-bash: code: command not found or

-bash: /bin/code: No such file or directory

My local machine is a Mac with Zsh, and the remote is linux using bash.

Thanks for any help :)

Ah77
  • 85
  • 1
  • 9
  • Have you installed VScode on the Linux machine? – Mark Setchell Nov 17 '22 at 23:06
  • This might sound stupid but how can I check this? If i run "code -v" to check the version from the ssh'd terminal I still see -bash: code: command not found. But if I do it from the VScode terminal I do see: 1.57.0 b4c1bd0a9b03c749ea011b06c6d2676c8091a70c x64 – Ah77 Nov 17 '22 at 23:47
  • I mean, I can open and edit files from the ssh remote session inside VScode app. But from my command line after ssh-ing I am not able to use "code myfile.txt" – Ah77 Nov 18 '22 at 00:52
  • When you ssh over and type commands, the command runs on the machine you ssh into. So your linux box is trying to execute `code myfile.txt`. Which means that the linux box must have code installed. Then you have to push the display back to your system (can be done with `ssh -X`. This will send the display back through the ssh connection). If you want to run code locally and edit files from the linux, use the ssh remote session like you already mentionned, or network mount the filesystem from linux to mac (other can of worms :) – Nic3500 Nov 18 '22 at 01:23

0 Answers0