I am new with virtual machine. I want to copy a file from host (Mac) to vagrant virtual machine. I could not share a folder, so I want to use command line. How can I copy a file from host to vagrant virtual machine with command line?
Transfer Files From Host To VirtualBox Using A USB stickInsert the USB device you wish to use. Launch VirtualBox and click File > Preferences, then Extensions and click +. Browse to the downloaded Extension Pack, click Open, then when prompted, Install. Follow the prompts to complete the process.
Essentially, cp [file] /var/www/[your vm]/. vagrant will copy the file to the . vagrant folder at your project root, where you can see and move the file in your desktop OS.
To copy a file from the host to vagrant:
scp -P 2222 /path/to/file [email protected]:.
To copy a file from vagrant to host machine:
scp -P 2222 [email protected]:/path/to/file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With