:: Re: [DNG] ID which /dev/pts/? runni…
Top Page
Delete this message
Reply to this message
Author: Ralph Ronnquist
Date:  
To: dng
Subject: Re: [DNG] ID which /dev/pts/? running just bash?
On Sun, Feb 11, 2024 at 07:04:52PM -0600, Mike McClain wrote:
> Howdy,
>     Most of what I do on the computer is text so I keep several VTs
> open, /dev/tty{1-10}, but now and then want to send some text to an open
> xterm window on the desktop. Since I've never managed to get
> copy/paste to work between a tty and an xterm window I have to go to X
> and see what the xterm running bash thinks it is then go back to a tty
> and '$ echo "something" > /dev/pts/X'.

>
>     Though I normally have 1 xterm running just bash, one running mc
> and firefox running, the pts running bash moves around.
> One time when I launch X it's /dev/pts/0 the next time it may be pts/1
> or pts/2. It is totally unpredictable even though I launch xterm, then
> mc, then firefox in that order consistantly.

>
>     At this moment "$ ps | grep 'pts.*bash'" shows bash running on
> /dev/pts/{0,1,3,4}. "$ ps | grep 'pts.*mc'" shows mc on pts/2, Firefox
> has many tasks running on pts/1 and by looking in X I can see that my
> single xterm window today is on pts/0. I've no clue what is going on
> on /dev/pts/{3,4} as ps doesn't tell me anything other than
> 'bash -rcfile .bashrc' for them both yet I have no other windows open
> in X.

>
>     Unfortunately '$ ps | grep xterm' shows '?' for the tty and
> "'$ ps | grep 'pst.*xterm'" returns nada.

>
>     If anyone can tell me how from a tty to know which pts is the open
> xterm I'd be most grateful.


If you have only one xterm, you might also do

$ ls -l /proc/$(pgrep xterm)/fd

and check the 0, 1 and 2 file descriptors.

Ralph.

>
> Thanks and Be Well,
> Mike
> --
> I reserve the right to be completely wrong.
> _______________________________________________
> Dng mailing list
> Dng@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng