Now I'm not gonna discuss something like don't stare without blinking your eyes or maintain some distance from monitor, but here is a way to optimize your monitors brightness automatically according to the time-of-the-day and temperature.
Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night.
To install it in Ubuntu:
sudo add-apt-repository ppa:jonls/redshift-ppa
sudo apt-get update && sudo apt-get install redshift
To start the application, first find the coordinates of your location (lat:long). Then
redshift -l lat:long (eg: redshift -l 17.033:55.20)
For latest version and also Windows installation, visit the official website.