Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Installing a Ruby Development Environment Installing a Ruby Development Environment Installing the Treehouse VM on Mac

Hai Le Quang
Hai Le Quang
5,855 Points

Could you explain the difference between "vagrant halt" and "exit"?

I believe exit is the same as Ctrl-C, closing the connection to server? But Jason already use Ctrl-C before, so what's the point of "exit"?

2 Answers

Merritt Lawrenson
Merritt Lawrenson
13,477 Points

'exit' is the command that exits the virtual machine and brings your command line back to your local computer. At that point you have to run 'vagrant halt'. You can't halt vagrant before you exit the virtual machine because otherwise the virtual machine itself is looking for vagrant to shut down, but vagrant is running on your computer, not the vagrant's virtual machine. If you don't exit the virtual machine and halt vagrant (just closing the terminal window, for instance), then the virtual machine keeps running in the background. There's nothing wrong with that, especially if you intend to come back and work again shortly, but if you don't shut your vagrant virtual machine down it will keep using your memory and cpu in the background.

Kristopher Van Sant
PLUS
Kristopher Van Sant
Courses Plus Student 18,830 Points

I'm not sure what you mean by exit. Ctrl-C is used to "exit" out of things, but this would be for exiting out of something like NPM or Grunt, which means you'd be stopping the web server. If you close out of the terminal vagrant is still running. Vagrant halt, however, shuts down the machine.

http://docs.vagrantup.com/v2/cli/halt.html