How do I find the current virtual terminal

Posted by camh on Stack Overflow See other posts from Stack Overflow or by camh
Published on 2010-06-14T01:08:43Z Indexed on 2010/06/14 1:12 UTC
Read the original article Hit count: 217

Filed under:
|
|

I am working around a problem in Ubuntu 10.04 where after resume, the mouse cursor disappears.

This can be "fixed" by running chvt 1; chvt 7 in a script in /etc/pm/sleep.d, such that those commands run on thaw and resume.

However, the X console is not always vt #7, so chvt 7 is wrong in those cases.

What I would like to do is find out the current vt in the fix-up script and make sure I change back to that vt.

How can I find the current vt? (tty(1) just reports "not a tty")

© Stack Overflow or respective owner

Related posts about linux

Related posts about shell