Ubuntu 14.10 Tip: Automatic Shutdown When Lid is Closed

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.

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.

or

HandleLidSwitch=hibernatehibernate when lid is closed

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

By Ji m

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to remind me outdated tutorial! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via ubuntuhandbook1@gmail.com Buy me a coffee: https://ko-fi.com/ubuntuhandbook1

Exit mobile version