문제

I had to reboot my box today. I had several program running in tmux sessions. They seem to be still alive, how can I reattach to them? I tried tmux a processID but it didn't work.

/home/me 21$ ps aux | grep tmux
me    1299  0.0  0.0  22244  1920 ?        Ss   Apr28   0:40 tmux -2 -f /tmp/r-plugin-me/tmux.conf new-session -s vimrpluginme1398670569alnn51oynp1vollnn51f2v4r_ied_delta1meRalphaCalibr VIMINSTANCEID=alnn51oynp1vollnn51f2v4r_ied_delta1meRal
me    2575  0.0  0.0  54164  3500 ?        S    07:35   0:00 xterm -e tmux -2 -f /home/me/.tmux.conf -S /tmp/vX0qRrR/78
me    2577  0.0  0.0  19892  1400 pts/2    Ss+  07:35   0:00 tmux -2 -f /home/me/.tmux.conf -S /tmp/vX0qRrR/78
me    2579  0.0  0.0  22128  1832 ?        Ss   07:35   0:00 tmux -2 -f /home/me/.tmux.conf -S /tmp/vX0qRrR/78
me    5155  0.0  0.0   6380   756 pts/4    S+   07:46   0:00 grep tmux
me   31340  0.0  0.0  23348  3000 ?        Ss   Apr28   0:17 tmux -2 -f /home/me/.tmux.conf -S /tmp/vIqEM06/78
도움이 되었습니까?

해결책

You can not re-attach a process id. You need to reattach the corresponding tmux session.

So do tmux ls. Pick whatever session you want to re-attach. Then do tmux attach -d -t <session id> to re-attach it to a new tmux instance and release it from the old one.

다른 팁

If you only have one session detached you can just do

tmux attach

also if you're going to be working in multiple sessions it might be a good idea to name your sessions

tmux new -s ssh-to-staging
Ctrl b, d   # Detach from session
tmux new -s ssh-to-s3
Ctrl b, d   Detach from session

now when you do tmux ls you can reattach more easily without guessing.

tmux attach -d -t ssh-to-s3

You also might wanna bookmark this cheat sheet

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top