Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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'm using Gnome on Ubuntu. I often have 8-20 terminal sessions open and in some of them I have su'd to a different user. The specific problem that caused me to write this query happens when using git status, but this is more general issue. git status will tell me I have an uncontrolled file This means that in one of my terminal sessions I have vi open on

I need a script or tool that would tell me in which terminal session that vi is running. I can do a "ps aux | grep vi" to pretty easily find the pid of the particular vi. It would be nice if the tool highlighted the terminal on my task bar in some way.



share|improve this question

migrated from Nov 25 '11 at 17:25

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

Did you consider using screen ? – WilQu Oct 28 '11 at 15:48
Never heard of screen. Just read the man page of byobu, the screen wrapper on Ubuntu. It looks too heavyweight for my intermittent problem -- I'd have to give up two lines at the bottom of my monitor). – Sam Oct 28 '11 at 16:32
With screen by itself, you give up nothing. Messages can be displayed over the last line or even in the windows title (hardstatus) - or you can give up some lines if you like. It is only when you split the terminal (vertically or horizonally) that you are required to give up a line (for each pane). – Arcege Oct 28 '11 at 18:38

Each of your terminal windows will have a different pseudoterminal assigned, as accessible by the tty command. You can cross-reference this with the TTY column of your ps u output. For GUI integration, I usually found it sufficient to add the current pty identifier to my terminal's window title using xtitle, like

if [ "$PS1" ] ; then
  xtitle xterm $(tty)

Jumping to a window by title is easy in my window manager, no idea about GNOME.

share|improve this answer

Your Answer


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