Ubuntu 14.10 Tip: Automatic Shutdown When Lid is Closed

September 27, 2014

automatic shutdown when lid is closed

Ubuntu provides a built-in Power utility which allows to choose your laptop behavior when the lid is closed. However, there are only “Suspend” and “Do nothing” available out-of-the-box.

ubuntu lid closed settings

What if you want to shutdown or hibernate Ubuntu automatically when laptop lid is closed?

See what I did in my 64-bit Ubuntu 14.10:

1. Press Ctrl+Alt+T on keyboard to open the terminal. When it opens, paste the command below and hit enter to edit the systemd-logind settings:

sudo gedit /etc/systemd/logind.conf

Replace gedit with vi or nano if you’re on Ubuntu server without a graphical user interface.

Type in user password when it asks. Note that there will be no visual feed back when type in a password.

2. When the file opens, find out the line #HandleLidSwitch=suspend. Remove the # and change the value so it will be:

HandleLidSwitch=poweroffpower off when lid is closed.


HandleLidSwitch=hibernatehibernate when lid is closed


3. After saved the changes, restart the computer so it takes place in next boot.

I'm a freelance blogger who started using Ubuntu 5+ years ago and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me on Google Plus or email to ubuntuhandbook1@gmail.com