It is easy to disable screen saver under X window. But when it comes to text based login or terminal you will not find easy way to disable text based power saving mode (i.e. when your screen goes blank after a few minutes).
So how do I disable the blank screen mode, which activated after a few minutes? Answer is use setterm command.
setterm writes to standard output a character string that will invoke the specified terminal capabilities. Where possible terminfo database (terminfo is a data base describing terminals, used by screen-oriented programs and libraries such as ncurses) is consulted to find the string to use.
By default, the Linux kernel will use screen-save option to disable it you need to type command (it turns off monitor VESA powersaving features):
$ setterm -powersave off -blank 0
If it dumps back you with an error that read as follows:
cannot (un)set powersave mode
You need to shutdown X window system and rerun the above command. Better, add following two commands to your ~/.xinitrc file:
setterm -blank 0 -powersave off -powerdown 0
xset s off
Other useful options
This command also supports other useful options:
Resets the terminal to its power on state:
$ setterm -reset
Alternatively, initialize terminal:
$ setterm -initialize
Turns the terminal's cursor on or off:
$ setterm -cursor [on|off]
Turns automatic line-wrapping on or off (virtual consoles only)
$ setterm -linewrap [on|off]
Sets the foreground text color (virtual consoles only):
$ setterm -foreground blue
Sets the background text color (virtual consoles only):
$ setterm -background red
Enables or disables the sending of kernel printk() messages to the console (virtual consoles only). Useful if you get lots message from iptables firewall:
$ setterm -msg [on|off]
I regularly use these (above) options.
See also:
- Please consult the setterm and terminfo man pages for more information.
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins

- My 10 UNIX Command Line Mistakes
- 25 PHP Security Best Practices For Sys Admins
- The Novice Guide To Buying A Linux Laptop
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
Facebook it - Tweet it - Print it -
We're here to help you make the most of sysadmin work. So, subscribe!

{ 12 comments… read them below or add one }
I wouldn’t use “setterm -msg off”, as you don’t get useful panic messages. Rather use “dmesg -n1″, so that you still get panic messages but not all the trivial junk to the console. Otherwise thank you for a useful page
Your guide was a great help, however it wasn’t enough for a clean approach on my Ubuntu 7.10 system.
I don’t have an .xinitrc, so instead I put this in ~/.bashrc:
xset s off > /dev/null 2>&1and this in /etc/rc.local
sh -c 'setterm -blank 0 -powersave off -powerdown 0 /dev/console 2>&1'This also does not produce errors even though I’m running an X session.
Somehow copy-paste screwed up before.
Here’s the code for rc.local:
sh -c 'setterm -blank 0 -powersave off -powerdown 0 /dev/console 2>&1'I’m very sorry to “spam” like this >_<
Figured < was interpreted as an HTML-tag.
Hopefully it should work now:
sh -c 'setterm -blank 0 -powersave off -powerdown 0 < /dev/console > /dev/console 2>&1'Great tips. Screen blanking used to irritate me on the console, too. Especially for my servers which I KVM into. There’s no screen to burn out, so why should the term go blank?
Anyway, I wanted to add that sometimes I’ll do something dumb, like cat’ing a binary file, and it completely screws the terminal window. The way to recover from that is just the ‘reset’ command. A lot of people probably don’t know that.
Before I learned about it, sometimes I’d be up to 3 or 4 terminals lost to garbage on the screen. Logging out never helped, and I used to have to restart the machine to recover them. ‘reset’ fixed that.
also you can just execute
echo -e ’33[9;0]33[14;0]‘
if your terminal supports CSI-sequences (if you use linux - you may shure that it does)
omg, ‘\33[9;0]\33[14;0]‘ i mean
To disable the screen blanking I put the suggested line into /etc/inputrc on my ubuntu server (no .xinitrc)
thanks, I like your pages (and format), they always seem to hit the problem right on the head.
Anne
Thank you so much! This comment saved me much trouble.
I’m somewhat of an ubuntu newbie, and chose to run a distro without a GUI to save resources for my minecraft server =P
How do I make this permanent? I did the lines Helge put up but once I reboot the system, it goes back to blank out the screen after about 15 mins.
I’ve previous turned off acpid and apmd with chkconfig.
I need to have the device load everything and remain with an active screen indefinitely. So far the only thing that lets me do that is this setterm command, however, when I reboot – it goes away.
To set this behavior permanently, add consoleblank=0 to the kernel command-line.
i am try to use your command in redhad but it is not work
i already have screensaver in terminal 7 and i try to disable it from another terminal with $ setterm -powersave off -blank 0
i do not get any error but it is not work and screensaver still work
also when i am try to use comman in gui by xset s off it also did not work i not know
i hope anyone could help me please