How do you open and edit files on vagrant?

I know this is a super easy and dumb question but this is my first time using a virtual machine.

For example, I want to open and edit part1.c in a text editor. I'm currently using Visual studio on my mac but I don't know where to go from here.

https://preview.redd.it/0brro5gqzge81.png?width=1414&format=png&auto=webp&s=0e2d4e31671c2a08520260475c193532b95b6c40

2 thoughts on “How do you open and edit files on vagrant?”

  1. This minimal vagrantfile will share the current directory (on your workstation) with the virtual machine. The files will be available on the VM in the directory `/vagrant`

    Vagrant.configure(“2”) do |config|
    config.vm.box = “generic/rocky8”
    config.vm.synced_folder “./”, “/vagrant”
    end

    You can edit your Vagrantfile the same way if `/vagrant` isn’t shared already.

    After `vagrant reload` you move or copy the files in your screenshot to `/vagrant` and you can edit them in an editor on the OSX side.

    Check the docs for more info: https://www.vagrantup.com/docs/synced-folders

    Reply

Leave a Comment