change brightness ubuntu 20.04

C++
# 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%
Source

Also in C++: