Stop monitor from going to sleep in ubuntu 16.04

Using Command Line.

I am using /etc/X11/xorg.conf file in Ubutnu 14.04, which has below lines written in it.

Section "ServerFlags"
Option "BlankTime" "60"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"

And it is working fine in Ubuntu 14.04 but not working in Ubuntu 16.04.

First, let’s see what the values of these keys are. You can do that by running the following three commands.

gsettings get org.gnome.settings-daemon.plugins.power sleep-display-ac
gsettings get org.gnome.settings-daemon.plugins.power sleep-display-battery
gsettings get org.gnome.desktop.session idle-delay

To set these by hand you can use the following three commands:

gsettings set org.gnome.settings-daemon.plugins.power sleep-display-ac
gsettings set org.gnome.settings-daemon.plugins.power sleep-display-battery
gsettings set org.gnome.desktop.session idle-delay

Just replace with the number of seconds you want the system to wait before turning off the display (and potentially locking the screen). To tell the system that it should let the display turned on forever, you can use the value 0:

gsettings set org.gnome.settings-daemon.plugins.power sleep-display-ac 0
gsettings set org.gnome.settings-daemon.plugins.power sleep-display-battery 0
gsettings set org.gnome.desktop.session idle-delay 0

Using A GUI
To change the keys you can use “dconf Editor “. You can start the program by one of the following ways:

go to Applications and either
search for dconf or
look for it under “System Tools” or
press Alt+F2 and enter: dconf-editor or
open a terminal and run “dconf-editor”
Once dconf Editor starts

On the left side you now need to navigate to “org.gnome.settings-daemon.plugins.power” (that means: open “org”, then – within “org” – open “gnome” and so on until you reach “power”). Then, you need to find the keys “sleep-display-ac” and “sleep-display-battery” on the right side.

Change both numbers to 0 to prevent the system from turning off the display.

After that you should navigate to “org.gnome.desktop.session” on the left side and change the key “idle-delay” (on the right side) to 0 as well.

After that, just quit the editor.