I start two new
tmux sessions, the session name is variably build from a timestamp. (the commands create a new, detached tmux session, which first changes the directory, lists the content and then opens bash, in order to keep the session open)
tmux new -d -s tmux-s1-2014-12-04-16-12-12-103728 'cd /home/user/dir/ect/; ls; bash' tmux new -d -s tmux-s2-2014-12-04-16-12-12-103728 'cd /home/user/dir/ory/; ls; bash'
Now if i us
ps aux to see if they are still running, I always just find one of them. (e.g.
ps aux | grep tmux)
user 13556 0.0 0.0 26288 1716 ? Ss 16:12 0:00 tmux new -d -s tmux-s1-2014-12-04-16-12-12-103728 cd /home/user/dir/ect/; ls; bash user 13686 0.0 0.0 8072 864 pts/1 S+ 16:14 0:00 grep tmux
Yet when i use
tmux list-sessions both are listed:
tmux-s1-2014-12-04-16-12-12-103728: 1 windows (created Thu Dec 4 16:12:20 2014) [80x23] tmux-s2-2014-12-04-16-12-12-103728: 1 windows (created Thu Dec 4 16:12:20 2014) [80x23]
I've now tested a little further and from what I understand now, detached sessions are invisible to
ps.. because of reasons. The first established session will be visible, even if detached.
I've created three sessions, all with
bash and detached the first and second session. The third session is still attached. Here's the output of
htop when filtering for
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command 17382 user 20 0 26296 1808 1176 S 5.0 0.1 0:00.86 ├─ tmux new -s first_session 17641 user 20 0 17552 1164 908 S 0.0 0.0 0:00.00 │ │ └─ tmux attach -t third_session
tmux list-sessions will still show all three:
first_session: 1 windows (created Fri Dec 5 10:35:11 2014) [80x23] second_session: 1 windows (created Fri Dec 5 10:35:23 2014) [80x23] third_session: 1 windows (created Fri Dec 5 10:35:37 2014) [80x23] (attached)
The question is still the same..
ps aux unable to list all detached and attached sessions?