Protect Your Eyes From Strain With Redshift in Linux

Did you ever have problems falling asleep after staying up late with a computer or smartphone? Most computer screens emit a blueish light by default to imitate daylight so that they appear more natural to look at. While it probably has an aesthetic advantage, it also has an unwanted side-effect.

Your sleep cycles are regulated by a hormone called melatonin which is secreted into your system in the absence of daylight. As soon as you see the sun (or rather the blue sky) in the morning, the production of the hormone stops until it gets dark again. Think about it like nature’s own sleeping draught built right into your system. Unfortunately the blue light of the screen blocks melatonin production, keeping you awake long after you have turned your screen off.

The solution would be to have the screen’s colours adjusted so there is less blue in it. Redshift is a simple tool that is capable of just that: It automatically adjusts the screen’s colour temperature according to your location and the time of day. It works much like f.lux on Windows or Mac. Redshift was in fact inspired by f.lux and is available free of charge for anyone wishing to use it.

Most major Linux distributions have packages built for easy installation. You would usually have two packages, “redshift” and “redshift-gtk.” The former is the basic package while the latter includes a system-tray indicator icon. To install both on a Debian-based system is as simple as  looking it up in the built-in software centre of your OS or typing

sudo apt-get install redshift redshift-gtk

into a terminal.

Before configuring redshift you should play around with the colour temperature settings until you find the one most suitable, unless you want to end up with a screen looking like you have a video cable problem. To achieve this, you can use the “one shot” option, with the -O switch.

For example, typing

redshift -O 3500

will set the screen colour temperature to 3500K (that is °Kelvin). (The neutral screen colour is 6500K; anything lower than that will turn your screen towards a more reddish hue.)

Redshift addjusted colour.

To reset to neutral, you can use the -x switch:

redshift -x

Of course 3500K is quite extreme. Play around with colour temperatures until you find a setting that still feels natural. It helps to have a few applications open, preferably those that have a light background, as these will show the greatest difference.

You would need to find the right settings for both daytime and night-time hours. The default values for redshift are 5500K/3500K respectively. Chances are that you will find the default daytime colour still “too red” as it is 1000K below “neutral.” If you do not want to change your usual display setting for the daytime, you can stick with 6500K and just find the ideal “redness” for the night.

To set both daytime and night-time temperatures, you can use the -t switch:

redshift -t DAY:NIGHT

The setting

redshift -t 6500:5000

would produce a less “forceful” colour change:

A more natural colour adjustment.

You could also dim/brighten your screen with gamma values between 0.1 and 1.0, using the -b switch, like

redshift -b DAY:NIGHT

If for example, you would like to dim your screen for the night to 60% brightness, while having it on full blast during the day, you could achieve this with

redshift -b 1.0:0.6

which would considerably darken your screen for the night, as you can see below.

Redshift addjusted brightness.

Once you have found the right colour and brightness settings, you will need some geographical data to auto-adjust to the daylight hours. Redshift can use your system’s built-in geo-location provider, so you will not need to worry about latitude and longitude details.

redshift -l list

will tell you what providers are available on your system.

Redshift showing available geolocation providers.

You can see above that geoclue is installed. Using it is easy:

redshift -l geoclue

If you do not have a location provider installed or you prefer not to use it, you can always set your latitude and longitude manually in the format of


If you don’t know your exact coordinates, you can use the Find Latitue and Longitude website to figure them out in seconds. If you are in Paris (France) for example, your coordinates would be:

redshift -l 48.850258:2.351074

Rredshift has some more advanced configuration options as well. To find out all its capabilities, use the -h switch:

redshift -h

Redshift help.

Now you know your desired screen colour temperature, brightness and your location. Assuming you are still in Paris, you want to have your night-time screen temperature at 5000K with the daytime setting unchanged, having full brightness during the day and 80% brightness at night, so you would type:

reshift -l 48.850258:2.351074 -t 6500:5000 -b 1.0:0.8

Or to automatically detect location:

redshift -l geoclue -t 6500:5000 -b 1.0:0.8

The results are somewhat more friendly:

A more natural colour adjustment.

If you also wanted to have a tray indicator icon when Redshift is running, that will allow you to enable/disable Redshift temporarily or permanently, you can use “gtk-redshift”:

gtk-redshift -l geoclue -t 6500:5000 -b 1.0:0.6

Redshift tray icon.

You can always check the status of Redshift by right-clicking this indicator and selecting “Info”:

Redshift info window.

To have it start automatically with your system, you would add the above command to your startup applications. On a Ubuntu-based system this would be as easy as typing “startup applications” into the dash (Unity) or the activities overview (Gnome shell) search …

Adding startup application.

… select Add …

Ubuntu startup applications dialogue.

… and paste your Redshift command.

Paste the command to start Redshift.

This would have Redshift start every time you boot your system and would adjust the screen according to your preferences.

Redshift is a great tool to prevent eye strain and insomnia. Of course, first you will need to get used to the slightly reddish hue of your screen at night, but that would come naturally after a few days of active use.

Good night!