Changing a process' tty?

Rasjid rasjidw at bigpond.com
Sat Sep 22 23:19:58 EST 2001


Rasjid wrote:
> 
> Just a wild stab in the dark here.
> 
> Is is possible to move a process from one tty to another?  In
> particular, is it possible to move a process started on an xterm (with
> TTY pts/2 say) to a console (tty1 say)?
> 
> This would be really useful, as sometimes I start ncftp or the like in
> an xterm, and then decide I want to restart X.
> 
> Cheers,
> 
> Rasjid.

I had had a few suggestions to use screen.  It seems to do what I want.

I have put the following lines at the end of my .bashrc file:

# -----------
if ( ps -p $PPID -o cmd | grep SCREEN &> /dev/null )
then
	echo "Bash session started by SCREEN"
	echo ""
else
	screen
fi
# -----------

This way I don't have to remember to start screen, and it avoids any
infinite loops.

Can anyone foresee any problem with this?

Rasjid.




More information about the linux mailing list