tmux-plugins / tmux-resurrect

Persists tmux environment across system restarts.
MIT License
11.42k stars 424 forks source link

how do i clear saved tmux-ressurect ? #341

Open sandikodev opened 4 years ago

sandikodev commented 4 years ago

there's any ways for cleaning/clear my tmux-resurrect saved session ? iam sorry if duplicated, let me know

daonb commented 4 years ago

The default location of the saved session is under ~/.tmux/resurrect with last linking to the latest file. Editing the file should work as well as deleting it.

jiaming10 commented 4 years ago

Another idea would be open tmux in a default state, and then save it.

It is not same as clearing the saved session though.

lexjacobs commented 4 years ago

--EDIT not needed, see below --

I added this to the top of my .tmux.conf

run -b "(cd ~/.tmux/resurrect; ls -tp | grep -v '/$' | tail -n +5 | xargs -I {} rm -- {})"

It will clean all but the latest 4 files every time the config is reloaded

If you choose to use it make sure the folder it changes to in the script matches the path to your resurrect folder.

lexjacobs commented 4 years ago

Just learned from the author of this plugin that tmux-resurrect already handles this

https://github.com/tmux-plugins/tmux-resurrect/blob/da1a7558024b8552f7262b39ed22e3d679304f99/scripts/save.sh#L271-L277

davidjb commented 4 months ago

Removing the entire .tmux/resurrect directory or its relevant contents will clear your saved session(s).

Where the default location is for this depends on a number of factors:

https://github.com/tmux-plugins/tmux-resurrect/blob/dd36a4561b0bb41987cccc299c85475012d8cf8b/scripts/helpers.sh#L1-L5

In short, it'll be at ~/.tmux/resurrect if that already exists (e.g. legacy support), or else at ~/.local/share/tmux/resurrect, unless XDG_DATA_HOME or HOME are set differently.