When you use tmux, it stores a socket so you can regain access to the detached sessions in the tmux server. These can be located in multiple places depending on your environment.
- First tmux checks if an absolute path is given via
- If not specified, it uses the flag
-Lto name the socket.
- The location where this socket is created is defined by
- If not, it will be created under
This is all documented under tmux's man page
Reminds me of
$TMPDIR isn't set, it will create the socket in
/tmp. Sometimes this folder is cleaned and you can loose access to your tmux server. If this happen, your process will still be running, but you simply won't be able to connect.
If you run
tmux list-session you will receive an error message:
$ tmux list-session failed to connect to server: Connection refused
When you check
ps aux | grep -i tmux or
htop you can definitely see that tmux is running. If you run
lsof -U you can also see the socket that tmux has open.
Now, reading through tmux's man page, you can find the answer. Under
-L it says:
If the socket is accidentally removed, the SIGUSR1 signal may be sent to the tmux server process to recreate it.
Now, I also checked OpenBSD's man page and it adds a bit more of information:
If the socket is accidentally removed, the SIGUSR1 signal may be sent to the tmux server process to recreate it (note that this will fail if any parent directories are missing).
If it doesn't work, check the parent directories.
So, solution. If you're only running one tmux server, you can do:
killall -SIGUSR1 tmux
If you want to target a specific instance of tmux, you can use
kill and specify the process ID.
If you want the numeric value, you can use
kill -l to get a list. In the machines I have access (OS X and Linux), this is 10, but I've checked references online for other OS' and it can change.