If you want to put your PC in sleep mode instead of hibernation when idle, the settings for Ubuntu it doesn’t exactly help to do this easily.
But we can do it manually from the Configuration Editor, use the Alt + F2 key combination and type
Browse through the editor’s sidebar up / Apps / gnome-power-manager / actions / by default, Ubuntu puts in suspension mode when the computer is plugged in and on hibernation mode for when you are using battery, to change this we just have to double click on sleep_type_battery and replace hibernate per suspend
Now the computer should be in sleep mode instead of hibernating when idle.
via | Lifehacker