You can not re-attach a process id. You need to reattach the corresponding session.tmux
So do . Pick whatever session you want to re-attach. Then do tmux ls to re-attach it to a new tmux instance and release it from the old one.tmux attach -d -t <session id>
There is no portable way to do this. There is a program https://github.com/nelhage/reptyr that can do this on Linux (it uses ptrace and interposes all the system calls), but I don't know how reliable it is or if it is still maintained. YMMV.
You should look for modern alternatives like .tmux
is superior to tmux for many reasons, here are just some examples:screen
To get the same functionality as explained in the answer recommending , you would need to do the following:screen
tmux by typing tmux into the shelltmux sessiontmux session by typing Ctrl+b and then dYou can now safely log off from the remote machine, your process will keep running inside . When you come back again and want to check the status of your process you can use tmux to attach to your tmux attach session.tmux
If you want to have multiple sessions running side-by-side, you should name each session using Ctrl+b and . You can get a list of the currently running sessions using $ or simply tmux list-sessions, now attach to a running session with command tmux ls.tmux attach-session -t <session-name>
can do much more advanced things than handle a single window in a single session. For more information have a look in tmux or the tmux GitHub page. In particular, here's an FAQ about the main differences between man tmux and screen.tmux
From my testing on 2.6, you'll need two things for the command to move an entire window over:tmux
$session_name)$window_index). This is actually optional -- if you omit this, then it defaults to the window in focus in the session you're pulling the window from.From this point, you can just change to the session you want to move the window into, into a command prompt, and type a command of this form:<tmux-escape>:
move-window -s $session_name[:$window_index]
...where, as noted before, the is optional (as indicated by the square brackets, which aren't actually part of the syntax
). To use some concrete examples:$window_index
# Moves from currently-focused window from session named `$session_name`
move-window -s $session_name
# Moves from window with index `$window_index` from
# session named `$session_name` into the current session
move-window -s $session_name:$window_index
Et voilà! Your window got moved. :)
EDIT: Added some more info on an alternative that omits .$window-index
The latest version of tmux (1.7) supports renumbering of windows.
If you just want to change the number of window 4 to 3, do this in window 4:
move-window -t 3
As Tim said, type to bring the last process back to foreground.fg
If you have more than one process running in the background, do this:
$ jobs
[1] Stopped vim
[2]- Stopped bash
[3]+ Stopped vim 23
to bring the fg %3 process back to foreground.vim 23
To suspend the process running in the background, use:
kill -STOP %job_id
The SIGSTOP signal stops (pauses) a process in essentially the same way Ctrl+Z does.
example: .kill -STOP %3
sources: