I'd like to be able to display the current location of the pointer on the X display. Is there any application which does this?

  • 1
    I found a solution. There's a package called xdotool that has an application named getmouselocation. It works like this: sconklin@xps-1:~$ xdotool getmouselocation x:1285 y:10 screen:0 – sconklin Jul 19 '11 at 21:33
  • 4
    please write that in an actual answer, once the site allows you to. – Isaiah Jul 19 '11 at 22:24
  • I wrote it up as an answer for you (wiki mode to not take undue rep for it). – Ilari Kajaste Jul 20 '11 at 7:52

There's a package called xdotool that has an application named getmouselocation, available from ubuntu repositories with sudo apt-get install xdotool. Running the command

xdotool getmouselocation

will output

x:1285 y:10 screen:0
  • 13
    Probably "watch xdotool getmouselocation" is what most people are looking for. – Nacho Coloma Dec 31 '13 at 12:44
  1. Install xdotool
  2. Open a terminal and paste this:

    while true; do clear; xdotool getmouselocation; sleep 0.1; done

Move the cursor over the screen and you will see live coordinates update on terminal.

  • 4
    or watch -n 0.1 "xdotool getmouselocation" – ziyuang May 3 '19 at 9:58

xev from the command line shows this. Try the following.


Current coordinates are displayed as root:(<x>,<y>).

  • 5
    It seems to be xev only shows the location when the mouse cursor is pointing at the window which xev opens. – Ilari Kajaste Jul 20 '11 at 7:54
  • Check out updated answer. – kcpr Sep 11 '15 at 7:36
  • 1
    @kcpr, what? I don't see any root:(<x>,<y>) in the terminal window that holds the xev data. – user1717828 Jan 3 '16 at 0:04
  • @user1717828, did You try what Ilari Kajaste suggested? – kcpr Jan 3 '16 at 0:08

Here's a python script:

#!/usr/bin/env python3
from Xlib import display
import sys

while True:
    c = display.Display().screen().root.query_pointer()._data
    x = c["root_x"]
    y = c["root_y"]

    sys.stdout.write(f'{x:04} {y:04}\r')

Save it to file myscript.py, and launch with python3 myscript.py.


Not a native Linux solution, but if you have Wine installed, Pixie is a free (as in beer) small app that will show you both your cursor's coordinates and the color of the pixel directly underneath it in several formats.

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.