Stop monitor from going to sleep in ubuntu 16.04

You can use gsettings for enabling and disabling monitor from going to sleep:

  • Disable turning off screen

    gsettings set org.gnome.desktop.session idle-delay 0
    
  • Enable turning off screen with 5 min delay

    gsettings set org.gnome.desktop.session idle-delay 300