By using Ubuntu’s Power Management Preferences, you can set your laptop to either enter a Suspended state (also known as ACPI sleep) or go into hibernate mode. The Suspend setting is good for short periods of inactivity (or while you are plugged in) since it does use a small amount of power, while the Hibernate mode works better for longer periods of inactivity (or while you are on battery power) since it writes the RAM contents to the hard drive.
1. Right-click on the battery icon in the notification area next to the clock.
2. Select Preferences.
3. Select the On AC Power tab.
4. Go down to When laptop lid is closed and select the desired value from the dropdown. Choices are Do Nothing, Blank Screen, Suspend, or Hibernate.
5. Select the On Battery Power tab.
6. Go down to When laptop lid is closed and select the desired value from the dropdown. Choices are Do Nothing, Blank Screen, Suspend, or Hibernate.
7. Click Close.