How to alter Ubuntu desktop configuration using terminal

Alter Ubuntu desktop configuration using gsettings utility. I will use it to change the number of seconds the desktop computer needs to be inactive before it goes to sleep.

List available schemas and look for ones related to the power subsystem.

$ gsettings list-schemas | grep power
org.gnome.power-manager
org.gnome.settings-daemon.plugins.power

Alternatively, list schemas, keys and values to look for power related ones.

$ gsettings list-recursively | grep "\\.power"
org.gnome.power-manager info-stats-type 'power'
org.gnome.power-manager info-history-type 'power'
org.gnome.power-manager info-stats-graph-points true
org.gnome.power-manager info-page-number 0
org.gnome.power-manager info-stats-graph-smooth true
org.gnome.power-manager info-history-graph-points true
org.gnome.power-manager info-last-device ''
org.gnome.power-manager info-history-time 21600
org.gnome.power-manager info-history-graph-smooth true
org.gnome.settings-daemon.plugins.power lid-close-ac-action 'suspend'
org.gnome.settings-daemon.plugins.power time-critical 300
org.gnome.settings-daemon.plugins.power power-button-action 'interactive'
org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor false
org.gnome.settings-daemon.plugins.power button-hibernate 'hibernate'
org.gnome.settings-daemon.plugins.power idle-dim true
org.gnome.settings-daemon.plugins.power button-power 'interactive'
org.gnome.settings-daemon.plugins.power lid-close-battery-action 'suspend'
org.gnome.settings-daemon.plugins.power priority 0
org.gnome.settings-daemon.plugins.power idle-brightness 30
org.gnome.settings-daemon.plugins.power active true
org.gnome.settings-daemon.plugins.power critical-battery-action 'suspend'
org.gnome.settings-daemon.plugins.power button-suspend 'suspend'
org.gnome.settings-daemon.plugins.power button-sleep 'suspend'
org.gnome.settings-daemon.plugins.power percentage-critical 3
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 900
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'suspend'
org.gnome.settings-daemon.plugins.power ambient-enabled true
org.gnome.settings-daemon.plugins.power notify-perhaps-recall true
org.gnome.settings-daemon.plugins.power percentage-low 10
org.gnome.settings-daemon.plugins.power percentage-action 2
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'suspend'
org.gnome.settings-daemon.plugins.power time-low 1200
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 1200
org.gnome.settings-daemon.plugins.power time-action 120
org.gnome.settings-daemon.plugins.power use-time-for-policy true

List keys in specific schema.

$ gsettings list-keys org.gnome.settings-daemon.plugins.power                           
lid-close-ac-action
time-critical
power-button-action
lid-close-suspend-with-external-monitor
button-hibernate
idle-dim
button-power
lid-close-battery-action
priority
idle-brightness
active
critical-battery-action
button-suspend
button-sleep
percentage-critical
sleep-inactive-ac-timeout
sleep-inactive-ac-type
ambient-enabled
notify-perhaps-recall
percentage-low
percentage-action
sleep-inactive-battery-type
time-low
sleep-inactive-battery-timeout
time-action
use-time-for-policy

List keys and values in specific schema.

$ gsettings list-recursively org.gnome.settings-daemon.plugins.power 
org.gnome.settings-daemon.plugins.power lid-close-ac-action 'suspend'
org.gnome.settings-daemon.plugins.power time-critical 300
org.gnome.settings-daemon.plugins.power power-button-action 'interactive'
org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor false
org.gnome.settings-daemon.plugins.power button-hibernate 'hibernate'
org.gnome.settings-daemon.plugins.power idle-dim true
org.gnome.settings-daemon.plugins.power button-power 'interactive'
org.gnome.settings-daemon.plugins.power lid-close-battery-action 'suspend'
org.gnome.settings-daemon.plugins.power priority 0
org.gnome.settings-daemon.plugins.power idle-brightness 30
org.gnome.settings-daemon.plugins.power active true
org.gnome.settings-daemon.plugins.power critical-battery-action 'suspend'
org.gnome.settings-daemon.plugins.power button-suspend 'suspend'
org.gnome.settings-daemon.plugins.power button-sleep 'suspend'
org.gnome.settings-daemon.plugins.power percentage-critical 3
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 3600
org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'suspend'
org.gnome.settings-daemon.plugins.power ambient-enabled true
org.gnome.settings-daemon.plugins.power notify-perhaps-recall true
org.gnome.settings-daemon.plugins.power percentage-low 10
org.gnome.settings-daemon.plugins.power percentage-action 2
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'suspend'
org.gnome.settings-daemon.plugins.power time-low 1200
org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 1200
org.gnome.settings-daemon.plugins.power time-action 120
org.gnome.settings-daemon.plugins.power use-time-for-policy true

Get description for specific key.

$ gsettings describe org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout
The amount of time in seconds the computer on AC power needs to be inactive before it goes to sleep. A value of 0 means never.
$ gsettings describe org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type   
The type of sleeping that should be performed when the computer is inactive.

Get the possible values for specific key.

$ gsettings range org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout
type i
$ gsettings range org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type   
enum
'blank'
'suspend'
'shutdown'
'hibernate'
'interactive'
'nothing'
'logout'

Check if specific key is writable.

$ gsettings writable org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 
true

Alter the value of specific key.

$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 3600

Read the value of specific key.

$ gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout     
3600