Logo
DiscoverWavesCommunities
Signup

Keep Linux Running When Laptop Lid is Closed!

an1info(58)
Published in
Indiaunited
Words
0
Reading
0 min
Listen
Play
2026-05-26 09:19

If you are a Linux user and use multiple laptops, manage servers remotely, connect your laptop to an external monitor, or use remote desktop access, you may want to keep your system running even when the laptop lid is closed. By default, all laptops are configured to enter sleep mode automatically when the lid is closed, which can interrupt your work, remote sessions, or background tasks.

In the Operating system you can turn off sleep mode on lid close, to do nothing when the laptop lid is closed from the settings > System > Power & battery

In this Windows operating system you can turn off it by Graphic User Interface (GUI) and it's easy to setup it, but in the Linux operating system, you can't turn off by system settings, there is setting to turn off it, you have to do manually with Command Line Interface, and it's not easy for normal user, even advance user also can't remember every time the command. So I am going to show you how you can disable sleep mode on lid close and set your Linux system to do nothing when the laptop lid is closed. This is useful if you want to run downloads, servers, or access your Linux system remotely even after closing the lid.

This configuration will works on most Linux distributions like Ubuntu, Debian, Kali Linux, Linux Mint, Parrot OS and others.

  1. Open the terminal, then open the logind.conf in nano editor by following command-

    sudo nano /etc/systemd/logind.conf
    

    1. Remove # tag on change to suspend into ignore this line - #HandleLidSwitch=suspend

      HandleLidSwitch=suspend

    2. Remove # tag on change to suspend into ignore this line - #HandleLidSwitchExternalPower=suspend

      HandleLidSwitchExternalPower=suspend

    3. Just the remove the # tag in this line - #HandleLidSwitchDocked=ignore

      HandleLidSwitchDocked=ignore

    4. Now save the file by pressing- Ctrl+O then press enter, for exit the Nano editor press Crtl+X

    5. Restart the system login configuration by this command-

      sudo systemctl restart systemd-logind
      

      System will restart and may ask multiple time the system password, after restart your system ready to perform any task also while closing the laptop lid. Thats all.

If you are facing any issue while configuration, you can watch the full video -

hive-197685
linux
ecency
hive-engine
india
technology
neoxian
archon
open-source
2026-05-26 09:19
an1info(58)
via ecency
$ 1.404
143
Read next
Linux Networking Mastery Series Part 4: DNS Configuration and Name Resolution
Linux Networking Mastery Series Part 4: DNS Configuration and Name Resolution
x9ed1732b3 months ago
FastVPN for Linux: VPN Solution for Open-Source Enthusiasts
FastVPN for Linux: VPN Solution for Open-Source Enthusiasts
guest096 months ago
Learn Ethical Hacking (#31) - Privilege Escalation - Linux
Learn Ethical Hacking (#31) - Privilege Escalation - Linux
scipio12 days ago