This question already has an answer here:

I want to turn the "Turn screen off when inactive for x minutes" setting (in the brightness settings) to "never" from the terminal, but I couldn't find the right command.

This will be used in a executable file to change a few settings on a Ubuntu live installation.

Edit:

Due to more involved reasons I want to change this specific setting which is independent of the screen saver settings (I think).

share|improve this question

marked as duplicate by jobin, Maythux, Warren Hill, Amith KK, precise Mar 7 '14 at 16:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2  
I have not the same problem. This settings works perfectly using it in the GUI. If there is the command in this thread somewhere, please give me a hint. – Hagadol Mar 6 '14 at 16:19
    
One of them was sudo xset s off, but as the accepted answer explains you'll need to do a little extra work. – jobin Mar 6 '14 at 18:32
gsettings set org.gnome.desktop.session idle-delay 0

will prevent your screen from locking and change that setting to never.

Notice: close / re-open the settings window to see the effects the command takes.

The value that you write there is the time (in seconds) that it will take for Unity to decide that you have not been doing anything and the screen should be locked.

share|improve this answer
    
I am not talking about the screen locking but this specific option, which makes the screen just turn black. – Hagadol Mar 6 '14 at 16:21
    
This is the setting you are talking about. – Bruno Pereira Mar 6 '14 at 16:23
    
I can tell you, that your command does not change the entry in the GUI. Furthermore, even when having this setting on, my screen never locks. – Hagadol Mar 6 '14 at 16:25
    
@Hagadol have you tried to close the settings window and open it again? – Bruno Pereira Mar 6 '14 at 16:28
    
yes, I tried that, the window is unchanged. – Hagadol Mar 6 '14 at 16:39

I think you can use this command:

xset s off

From the xset manual page (man xset):

s       The  s  option  lets you set the screen saver parameters.  This
       option   accepts   up   to   two   numerical   parameters,    a
       'blank/noblank'  flag,  an  'expose/noexpose' flag, an 'on/off'
       flag, an 'activate/reset' flag, or the 'default' flag.   If  no
       parameters  or  the  'default' flag is used, the system will be
       set to its default screen saver characteristics.  The  'on/off'
       flags  simply  turn  the screen saver functions on or off.  The
       'activate' flag forces activation of screen saver even  if  the
       screen  saver  had  been  turned  off.  The 'reset' flag forces
       deactivation of screen saver if it is active.  The 'blank' flag
       sets  the preference to blank the video (if the hardware can do
       so) rather than display a background pattern,  while  'noblank'
       sets  the preference to display a pattern rather than blank the
       video.  The 'expose' flag sets the preference to  allow  window
       exposures  (the  server  can  freely  discard window contents),
       while 'noexpose' sets the preference to  disable  screen  saver
       unless  the  server  can regenerate the screens without causing
       exposure events.  The length  and  period  parameters  for  the
       screen  saver  function  determines how long the server must be
       inactive for screen saving  to  activate,  and  the  period  to
       change  the background pattern to avoid burn in.  The arguments
       are specified in seconds.  If only one numerical  parameter  is
       given, it will be used for the length.

for Gnome and Unity desktops, to turn lock screen after an amount of time off:

gsettings set org.gnome.desktop.screensaver lock-enabled  false

to turn it back on:

gsettings set org.gnome.desktop.screensaver lock-enabled true

You can also set x minutes after which the screen will lock after the screen blanks, but you have to enter it as seconds (multiply by 60):

gsettings set org.gnome.desktop.screensaver lock-delay "x"

An example values are 300 for 5 minutes - you may be able to enter as minutes in the following bash line:

gsettings set org.gnome.desktop.screensaver lock-delay $(echo X*60 | bc)

Where X is a number in minutes - seems to work in Ubuntu 13.10.

Oh, and to disable screen dimming:

gsettings set org.gnome.settings-daemon.plugins.power idle-dim false
share|improve this answer
    
Doing this does at least not change the info in the GUI, thus I think this is not the correct option... – Hagadol Mar 6 '14 at 16:13
    
gsettings set org.gnome.desktop.screensaver lock-enabled false works for me in Ubuntu 16.04. – Lucas Sep 26 '16 at 21:41

Try this it worked to me at least :

xset +dpms
xset dpms 300

300 is 5 min , so if it is 5 min inactive , it will power off .

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.