Prevent Screen Blanking on Multi-User Target or Runlevel 2/3

How To

By default, the kernel decides when to make the console go blank / black (usually 10 minutes / 600 seconds).

To check the current value:
$ cat /sys/module/kernel/parameters/consoleblank

To temporarily update the value:
$ setterm -blank <value>

Note: If the value is 0, blanking will be disabled entirely.

To permanently update the value, use one of the following methods:

  1. Edit the Grub configuration files to include this kernel parameter:
    consoleblank=0
  2. Create a startup script that contains:
    setterm -blank <value>

CentOS 7

Changes to the kernel parameters can be made within the /etc/default/grub file, within the GRUB_CMDLINE_LINUX entry.

Example:
GRUB_CMDLINE_LINUX="[...] consoleblank=0"

To make this change effective:
# grub2-mkconfig -o /boot/grub2/grub.cfg

Note: If using EFI instead of MBR, use the following to make the change effective:
# grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

CentOS 6

Changes to the kernel parameters can be made within the /etc/grub.conf file, within the kernel entry.

Example:
kernel [...] consoleblank=0

To make this change effective:
# grub-install <device/partition>

Note: Most of the time the device will be /dev/sda but always double check.

Ubuntu

Changes to the kernel parameters can be made within the /etc/default/grub file, within the GRUB_CMDLINE_LINUX_DEFAULT entry.

Example:
GRUB_CMDLINE_LINUX_DEFAULT="[...] consoleblank=0"

To make this change effective:
# update-grub > /boot/grub/grub.cfg