abilash
abilash

Reputation: 897

Simulating key press using bash

I try to run gedit from terminal and type some text in a file opened there, but have no success. I try to use gedit; sleep 2; xte -x display 'key k'; command but this one run gedit only(without typing the k char). Can some one chip in me?

Upvotes: 7

Views: 14344

Answers (1)

BeniBela
BeniBela

Reputation: 16907

Xdotool (no idea what happened to the webpage, here is its source) is great for that:

xdotool key k

And with gedit:

gedit & sleep 2; xdotool key k; 

Upvotes: 7

Related Questions