Created
May 4, 2026 09:00
-
-
Save oppara/2c5cdb25d24e31d7039e6ff99a72c526 to your computer and use it in GitHub Desktop.
tmux-session-killer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # Fast tmux session switcher using fzf | |
| # | |
| # Lists sessions sorted by last attached time (most recent first), | |
| # excludes current session, and switches to the selected one. | |
| # | |
| # Usage: | |
| # Bind to a key in tmux.conf: | |
| # bind C-j display-popup -E "tmux-session-switcher" | |
| # | |
| # Requirements: fzf | |
| target=$(tmux list-sessions -F '#{session_last_attached} #{session_name}' \ | |
| | sort -rn \ | |
| | sed -E 's/^[0-9]* //' \ | |
| | grep -v "^$(tmux display-message -p '#S')$" \ | |
| | fzf --reverse) | |
| if [[ -n $target ]]; then | |
| tmux kill-session -t "$target" | |
| fi |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/raine/tmux-tools/blob/main/tmux-session-switcher