This tutorial shows you how to change Ubuntu 13.10 behavior to make it shutdown, hibernate, suspend or do nothing when your laptop lid is closed.
Ubuntu Unity provides a built-in utility allows to change lid closed behavior, but it only allows to suspend and do nothing in my Ubuntu 13.10 machine:
If you want to hibernate or shutdown, or you’re on Ubuntu Server without GUI follow the below steps:
1. Press Ctrl+Alt+T on keyboard to open terminal. When it opens, run command to edit the config file:
sudo gedit /etc/systemd/logind.conf
For server edition, replace gedit with vi (Press i to start and Esc to exit editing, : followed by wq to save file.)
2. Find the line #HandleLidSwitch=suspend, remove the # and change it to:
HandleLidSwitch=poweroffto shutdown computer when lid is closed
HandleLidSwitch=hibernateto hibernate computer when lid is closed
HandleLidSwitch=ignoreto do nothing
3. Save the file and restart the service or just restart your laptop to apply the changes.
sudo restart systemd-logind
That’s it. Enjoy!