Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I got the window id by using xwininfo command. I want to change the focus of this window by a terminal command. How can I do it?

share|improve this question

migrated from stackoverflow.com Nov 18 '11 at 13:05

This question came from our site for professional and enthusiast programmers.

You could use xdotool. I have used it to resize browser windows.

$ xdotool windowfocus 0x280000a
share|improve this answer
It works. The sad thing is that I cannot install xdotool in the pc I want because I am not the admin. Is there any other (more standard) way? – Giannis Rizos Nov 17 '11 at 9:37
Maybe ask your window manager. Also, can't be that big of a deal to compile it on whatever computer you want to use it? Or copy a binary. – plundra Nov 17 '11 at 9:38
Of course I would do that. But I can't even copy files to my pc. No usb, no cd, no internet connection :) – Giannis Rizos Nov 17 '11 at 9:49
Αny suggestions without xdotool? – Giannis Rizos Dec 14 '11 at 9:43
Do you have wmctrl? – Mike Aug 27 '15 at 17:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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