The following tip will help you to disable the powersaving or sleep mode behavior of your CentOS or RHEL laptop or desktop. If GUI is present, the following steps will help.
Applications => Utilities => Tweak Tool => Shell => Don't suspend on lid close => ON
But if GUI is not installed, then the only option is to disable this from the commandline. It is very easy, don’t worry. Who cares about the GUI in Linux. ? 🙂 (I love the black screen)
Open /etc/systemd/logind.conf, then make edit in the following configuration. By default, the value of this config will be suspend
HandleLidSwitch=ignore
man logind.conf will provide the complete details about this configuration file. Hope this tip helps.