I'm using the tmux-resurrect plugin to recreate tmux sessions after tmux is shutdown. It mostly works but it is not restoring running commands. I've tried with vim, less, man and tail, all supported, but I get nothing but a waiting bash prompt.

Here's the save data for one pane that was running vim test.txt as seen in one of the save files in ~/.tmux/resurrect:

pane 0 1 :bash 1 :* 2 :/tmp 0 vim :

Clearly something is missing here. Where is "test.txt"? Pretty hard to recreate a command if the arguments aren't persisted.

Why aren't full commands being saved?

I am running this on Cygwin which I suspect is relevant.


The root of the problem is the hobbled version of ps that Cygwin provides because, in their words, due to the limitations of simulating a POSIX environment under Windows, there is little information to give. In particular this version of ps will not show command arguments. The solution is to install a more helpful substitute for ps and integrate it into tmux-resurrect.

Start by installing pgrep. This can be found in the Cygwin package psutils-ng (For 64-bit Cygwin. For 32-bit it might still be called just psutils.)

Now we need to tell tmux-resurrect to use it. Fortunately it already has a strategy available to use this tool. However, it's not quite compatible with the Cygwin version so edit the file [tmux-resurrect-install-dir]/save_command_strategies/pgrep.sh and change

\pgrep -lf -P "$PANE_PID" |


\pgrep -af -P "$PANE_PID" |

That's a single letter change, l to a.

Finally, tell the plugin to use this strategy by adding this line to your .tmux.conf file after any other resurrect configuration:

set -g @resurrect-save-command-strategy 'pgrep'

That should do it. Next time a session is saved the example given above should look more like this:

pane 0 1 :bash 1 :* 2 :/tmp 0 vim :vim test.txt

Upon restore that file will be loaded into vim.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.