# Moving terminal to other computer possible?



## schuss (Mar 15, 2011)

Hi,

I started a port install from a shell window on one Windows machine with PuTTY. I could not stay at the location of that computer until the port was completely installed. I could wait finishing the install until a moment when I am at the machine again, but it would be great to finish it from another machine. Is this possible? To take over a terminal from one Windows machine to another.

I hope I made myself clear and that I am in the proper group. Please correct me if I am in the wrong group.

Greetings,
Schuss


----------



## wblock@ (Mar 15, 2011)

sysutils/tmux is the new hotness, sysutils/screen is the old standard.  Unfortunately, you have to install and use them before starting the session.


----------



## DutchDaemon (Mar 15, 2011)

I think I heard someone say that a *^Z*, followed by starting *tmux* or *screen*, and then foregrounding the job again should work. There's also a utility with which you can snoop on an active tty (to see how anything running there is progressing), but the name escapes me right now. Someone will be along shortly.

Oh yes, watch(8).


----------



## wblock@ (Mar 15, 2011)

Well, there went my last excuse.


----------



## DutchDaemon (Mar 15, 2011)

Yes, start looking for that Netgear from the other thread.


----------



## wblock@ (Mar 16, 2011)

But my brain is full.  Every time I learn something new, like ctrl-b for tmux, I forget something old, like, oh, what is it, that thing, you know, the thing, not _that_ thing but the other thing, you know, the one that's like that other thing that one time.


----------



## wblock@ (Mar 16, 2011)

Hmm.  tmux starts a new session, so it doesn't see the jobs in the old one.  My ignorance is my strength, and I'm feeling particularly strong today.


----------



## UNIXgod (Mar 16, 2011)

There is a tool called dtach which is not as full featured as screen and tmux but can also deal with losing connected terminals and is simple to script with.

http://dtach.sourceforge.net/

Looking for those extra features? dvtm can add tiled terms inside your terminal giving you the closest thing I've seen to a desktop like env inside the terminal.

http://www.brain-dump.org/projects/dvtm/


----------



## sixtydoses (Mar 16, 2011)

DutchDaemon said:
			
		

> I think I heard someone say that a *^Z*, followed by starting *tmux* or *screen*, and then foregrounding the job again should work. There's also a utility with which you can snoop on an active tty (to see how anything running there is progressing), but the name escapes me right now. Someone will be along shortly.
> 
> Oh yes, watch(8).



Back then before I learned about sysutils/tmux and sysutils/screen, I used to use 'suspend' my work if I have to move to a different server.

*^Z* to suspend a running job. Use the jobs() command to list out suspended jobs, and use fg() command to resume the job on foreground, or bg() command to resume the job in the background.


```
root@dotbox [/usr/ports/x11-toolkits/termit] # [FILE]jobs[/FILE]
[1]  + Suspended                     make install clean

root@dotbox [/usr/ports/x11-toolkits/termit] # [FILE]fg 1[/FILE]
make install clean
Scanning dependencies of target termit
Scanning dependencies of target gmo
[ 11%] Building C object src/CMakeFiles/termit.dir/termit.c.o
[ 11%] Language: fr
[ 11%] Language: hu
[ 11%] Language: ko
^Z
Suspended

root@dotbox [/usr/ports/x11-toolkits/termit] # [FILE]bg 1[/FILE]
[1]    make install clean &
install  -o root -g wheel -m 444 /usr/ports/x11-toolkits/termit/work/termit-2.7.0/doc/rc.lua.example /usr/local/share/doc/termit
===>   Compressing manual pages for termit-2.7.0
===>   Registering installation for termit-2.7.0
===>  Cleaning for termit-2.7.0

[1]    Done                          make install clean
```


----------



## schuss (Mar 16, 2011)

Thanks guys. Now I can go figure out how to use those utilities.

Regards,
Schuss


----------



## DutchDaemon (Mar 16, 2011)

In fact, most people use only a tiny sub-set of commands. I hardly ever use anything more (for tmux) than:

Start a new shell under tmux:
[cmd=]tmux new[/cmd]

Start a job under tmux (without entering tmux itself):
[cmd=]tmux new -d '/some/program/or/script'[/cmd]

Attach to a running job (when there's only one tmux session running)
[cmd=]tmux a[/cmd]

List all running tmux sessions:
[cmd=]tmux ls[/cmd]

```
0: 1 windows (created Thu Mar  3 16:25:44 2011) [80x23]
1: 1 windows (created Thu Mar  3 16:25:51 2011) [80x23]
```

Attach to a specific session:
First one:
[cmd=]tmux a -t 0[/cmd]
Second one:
[cmd=]tmux a -t 1[/cmd]

Detach from a session (from within tmux):
[cmd=]Ctl-b d[/cmd]

The rest is in the excellent manual, tmux(1).


----------

