Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simulating key press using bash

Tags:

linux

bash

ubuntu

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?

like image 345
abilash Avatar asked Jan 06 '13 11:01

abilash


1 Answers

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; 
like image 155
BeniBela Avatar answered Oct 19 '22 10:10

BeniBela