brightness control in ubuntu code example

Example 1: change brightness ubuntu 20.04

# xrandr will list the displays you have connected eg HDMI-0 or DP-0 ...
xrandr 
# here's an example of changing an HDMI display 
# I have connected to 90% brightness
xrandr --output HDMI-0 --brightness 0.90
# --output is for the name of display
# --brightness is brightness ratio with 1.0 being 100%

Example 2: lower brightness of a ubunut pc

$ xrandr --output [monitor-name] --brightness [brightness-level]
$ xrandr --output LVDS-1 --brightness 0.75