I would like to emulate mouse scrolling through a keyboard shortcut. What I mean by that is whether I have a browser or terminal open, I want to be able to scroll through it exactly the same way I would scroll using my mouse.

I know that many terminals allow to scroll using Ctrl+Page Up/Down, however it still would not be what I'm looking for, as I need single line scroll, working not only in a terminal but in all of the applications. I have a trackpad which supports scrolling on my laptop and a USB mouse which also supports scrolling.

I am using Ubuntu Linux LTS 14.04.

1 Answer 1


You can inject input events with xdotool. You can invoke commands on a key press with xbindkeys. Put something like this in your ~/.xbindkeysrc:

"xdotool click 4"
"xdotool click 5"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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