18

I am using ASUS UX303 LN, Laptop and Ubuntu Gnome 14.04 is installed on it. I cant find a way to turn on my keyboard backlight on it. The keyboard shortcut that works in windows is not working here. Please help

1
  • you must check the layout of your keyboard and change it to what fits your needs
    – user284234
    Jul 4 '15 at 12:50
30

To enable the backlight:

echo 2 | sudo tee /sys/class/leds/asus::kbd_backlight/brightness 

The 2 at echo 2 | can be changed to a value between 0 - 3, with 3 being the brightest.

To disable the backlight, enter:

echo 0 | sudo tee /sys/class/leds/asus::kbd_backlight/brightness

The path may vary depending on laptop model and your OS. For example Lenovo Thinkpad L390 running Manjaro has /sys/class/leds/tpacpi::kbd_backlight/brightness. You can use find to see the correct path:

find /sys/class/leds -name '*kbd_backlight'
4
  • 2
    It works when i type in, but when I add it as a custom keyboard shortcut its not working Jul 4 '15 at 15:14
  • 1
    Why turning on keyboard backlight needs administrative permission?
    – funicorn
    Jan 11 '18 at 12:13
  • 1
    @funicorn because you are changing hardware features
    – TellMeWhy
    Jan 11 '18 at 22:50
  • echo 0 | sudo tee /sys/devices/platform/thinkpad_acpi/leds/tpacpi::kbd_backlight/brightness echo 3 | sudo tee /sys/devices/platform/thinkpad_acpi/leds/tpacpi::kbd_backlight/brightness Thinkpad...
    – xerostomus
    Mar 14 at 12:50
12

Try

xset led on

or

xset led 3

This worked well with my CMSTORM (Cooler Master Storm Devastator) keyboard.

0
5

You can turn on backlight by this command

sudo tee /sys/class/leds/asus::kbd_backlight/brightness <<< 3

This will set it to maximum. The number at the end means brightness ( 0 - 3).

You can link this command to some hot key combination.

You can also read article regarding setting up Ambient Light Sensor.

6
  • It works when i type in, but when I add it as a custom keyboard shortcut its not working Jul 4 '15 at 15:17
  • 2
    This is actually another topic how to setup a script requiring sudo to a key combination. It must be answered already somewhere. I make a script and set that it does not require a password in sudoers.
    – Pilot6
    Jul 4 '15 at 15:21
  • Works for live tech ergonomic keyboard as well. Feb 26 '20 at 13:05
  • This gives me tee: '/sys/class/leds/asus::kbd_backlight/brightness': No such file or directory 3. Anything else I can try?
    – Andyc
    Sep 14 '20 at 17:52
  • This means that there is no backlight, or it is not supported.
    – Pilot6
    Sep 14 '20 at 18:00
4

Here's how I got it solved:

#!/bin/bash
# Adjust the keyboard backlight level

shopt -s -o nounset

declare -i KBD_BACKLIGHT_MAX=`cat /sys/class/leds/asus\:\:kbd_backlight/max_brightness`
declare -i KBD_BACKLIGHT_LEV=`cat /sys/class/leds/asus\:\:kbd_backlight/brightness` 

# We need a parameter, etiher inc or dec
if [ $# -eq 0 ] ; then
   exit 192
fi 

case $1 in
-inc ) 
   # increasing:
   if [ ${KBD_BACKLIGHT_LEV} -lt ${KBD_BACKLIGHT_MAX}  ] ; then
      KBD_BACKLIGHT_LEV=${KBD_BACKLIGHT_LEV}+1
      echo ${KBD_BACKLIGHT_LEV} | tee /sys/class/leds/asus::kbd_backlight/brightness
   fi
   ;;
-dec )
   # decreasing:
   if [ ${KBD_BACKLIGHT_LEV} -gt 0 ] ; then
      KBD_BACKLIGHT_LEV=${KBD_BACKLIGHT_LEV}-1
      echo ${KBD_BACKLIGHT_LEV} | tee /sys/class/leds/asus::kbd_backlight/brightness
   fi
   ;;
esac

exit 192

Save the above script in /opt/tweaks/kbd_backlight_adjust.

Then this needs to be run with sudo from a keyboard shortcut so we must add a line to sudoers.

Use visudo and add this line to the bottom:

your_username ALL=(root) NOPASSWD: /opt/tweaks/kbd_backlight_adjust

And finally create your keyboard shortcuts using these commands for increasing and decreasing the keyboard backlight:

sudo /opt/tweaks/kbd_backlight_adjust -inc

and

sudo /opt/tweaks/kbd_backlight_adjust -dec

That should do it :-)

3
  • excelent ! just missing the command chmod +x /opt/tweaks/kbd_backlight_adjust to enable of script execution.
    – cgasp
    Jun 4 '16 at 22:30
  • Thank you for this script. It worked fine for me and solved my problem.Running Ubuntu 20.04 on Lenovo Thinkpad X1 Yoga Gen4
    – RazTaz
    Jun 20 '20 at 22:21
  • What if I have no opt/tweaks directory?
    – Andyc
    Sep 14 '20 at 17:52
2

I had the same issue with an Asus ROG laptop I'd purchased. Here's what I did to fix keyboard shortcuts in general.

sudo vim /etc/default/grub

You’ll find this line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Simply add on to the end of it:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi="

Save, Exit and Reboot

1
  • This is not working for me on an ASUS ROG G401IU with Ubuntu 20.04. I tried with both acpi_osi=, acpi_osi=linux with and without acpi_backlight=vendor. When I reboot the computer, the keyboard backlight is off again.
    – Andyc
    Sep 6 '20 at 6:11
-1

You can easily update kernel using "Ukku Kernel Update Utility" https://github.com/teejee2008/ukuu Updates to 5.x kernel solve all my problem on Asus UX433F (backlight, sound).

Not the answer you're looking for? Browse other questions tagged or ask your own question.