Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm using oneiric with unity. I want to find a solution to automatically save the state of my virtualbox virtual machine before I logout or shutdown because I always forget to do it manually. I know I can use Vboxmanage controlvm [vmname] savestate to save state in terminal. But how do I make ubuntu execute this command before logging out?

share|improve this question

1 Answer 1

You can add the Vboxmanage command to your ~/.bash_logout file and it will execute upon the logoff event.

share|improve this answer
Will this run automatically when logging out of an X session? I think, at least, that X will be closed, taking VirtualBox with it, before ~/.bash_logout would be executed. The best answer is for them to implement virtualbox.org/ticket/1888 so VBox will do it automatically. In the meantime, perhaps something like ~/.kde/shutdown, or whatever your DE provides, would help by running when you log out of your X session. –  blujay Aug 30 '12 at 15:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.