I've written a script to change the brightness of my screen.

It's useful when I am working on text mode and shortcut keys of my keyboard to change brightness doesn't work.

Is it possible to run this script, just by pressing some keys on the keyboard as shortcut, for example Ctrl+Alt+F7?

  • 2
    What do you mean by “on text mode”? Do you mean the text mode console (i.e. outside X Window)? On what operating system? Commented Aug 3, 2012 at 22:28

2 Answers 2


Try xbindkeys.

Your ~/.xbindkeysrc would look something like

    Control + Alt + F7
  • This is a great answer. xbindkeys is awesome.
    – user9031
    Commented Aug 3, 2012 at 15:46
  • @AlexWebr, Mikel Yes, but it's for X, and I think the question is about doing this outside X. Commented Aug 3, 2012 at 22:28
  • I'm not familiar with xbindkeysrc can you explain more?
    – M0εiπ
    Commented Aug 5, 2012 at 7:18
  • 2
    This is a simple configuration: nongnu.org/xbindkeys/xbindkeysrc_d
    – user9031
    Commented Aug 5, 2012 at 14:45
  • I tried but it won't release the keys back to me. It acts like it still holds down Ctrl/Alt keys. I have to wait for ~5 seconds for it to release it back to me.
    – deppfx
    Commented Aug 6, 2015 at 5:18

If you're working in a terminal and don't have X running, a bit of a hack is to alias your script to a single character in your shell's configuration. Example for bash:

alias b='~/bin/brightness-script down'
alias B='~/bin/brightness-script up'

Disadvantage: you have to press Enter each time. Alternatively, you could do b;b;b;b;b[Enter] to step the brightness down 5 times.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .