Linux字符界面自动关闭屏幕输出/笔记本屏幕合上禁止休眠

util-linux包(默认安装的包)中有一个软件叫setterm,可以控制屏幕交互

感谢arch wiki:
https://wiki.archlinux.org/index.php/Display_Power_Management_Signaling

$ setterm --blank 1 --powerdown 1 --powersave on

即可使屏幕1分钟不操作后自动关闭

另外,让笔记本屏幕合上不休眠:(https://wiki.debian.org/Suspend

$ systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

https://www.feutl.com/blog/2020-01-29-switch-off-backlit-for-laptops-running-as-a-server

Sadly, the backlit of the display is not switching off, which leads to a broken display after a while and consumes additional energy. The simplest way to fix the issue was to change the consoleblank setting at boot. This did not need any additional packages like ACPI or any extra user scripts at startup.

Verify the value used at the moment with cat /sys/module/kernel/parameters/consoleblank. The value is in seconds. The easiest way to add the parameter at boot is using the kernel command-line.

Open /etc/default/grub
Add consoleblank=600 to the GRUB_CMDLINE_LINUX_DEFAULT= which sets the timeout to 10 minutes (600 seconds).
GRUB_CMDLINE_LINUX_DEFAULT="quiet consoleblank=0"
Run sudo update-grub, and reboot.

此处评论已关闭