TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Use fzf for tmux session switching

179 pointsby samesenseabout 3 years ago

15 comments

ray__about 3 years ago
I still don&#x27;t quite understand the value of tmux, at least on a modern machine. If I need another terminal, I just pop open another terminal window and tile or tab it. If I want to keep a set of terminals organized, I use workspaces (at the OS level).<p>I can obviously see its value if there is no window manager or desktop environment on the system I&#x27;m using, but that&#x27;s rare these days–if I&#x27;m working on a system with neither of these it&#x27;s always over ssh. With a WM or DE it seems like tmux just adds a redundant layer of organization. What am I missing?
评论 #31310667 未加载
评论 #31311269 未加载
评论 #31310709 未加载
评论 #31311126 未加载
评论 #31342042 未加载
评论 #31313042 未加载
评论 #31312708 未加载
评论 #31310960 未加载
dbdoskeyabout 3 years ago
If you like tmux, take a look at zellij (<a href="https:&#x2F;&#x2F;github.com&#x2F;zellij-org&#x2F;zellij" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;zellij-org&#x2F;zellij</a>), it is a modern alternative that has a lot of nice features (either developed, or on the roadmap) that tmux is missing.<p>Have no relationship to it, just a happy &quot;customer&quot;.
评论 #31312257 未加载
评论 #31311698 未加载
评论 #31311911 未加载
评论 #31339818 未加载
a-dubabout 3 years ago
tmux sessions are incredibly useful for keeping multiple projects organized.<p>i just wish i could connect to remote tmux back ends and recover windows as organized locally after a network cut.<p>so the local tmux presents the ui and performs session management, and the remote tmux backends hold the shells to provide network cut resilience, but still rely on the local ui instance for all user interaction (so cut&#x2F;paste buffers and mousing and such are preserved)
评论 #31309004 未加载
评论 #31309486 未加载
评论 #31310093 未加载
评论 #31313146 未加载
评论 #31309484 未加载
评论 #31313068 未加载
anelsonabout 3 years ago
I had this problem myself when using tmux (how to switch sessions quickly and easily).<p>I ended up writing a shell script [1] to use fzf to display a list not only of sessions, but the windows within each session.<p>Which I invoke from tmux like this:<p>bind C-a run-shell -b &quot;$HOME&#x2F;.local&#x2F;bin&#x2F;ftwind&quot;<p>This has become so ingrained in my tmux workflow that I would be utterly helpless without it.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;anelson&#x2F;dotfiles&#x2F;blob&#x2F;master&#x2F;home&#x2F;.local&#x2F;bin&#x2F;ftwind" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;anelson&#x2F;dotfiles&#x2F;blob&#x2F;master&#x2F;home&#x2F;.local&#x2F;...</a><p>EDIT: for formatting
hyperplabout 3 years ago
If this tmux-fzf setup could be augmented to perform preview and grep not only on window name but also window contents then I&#x27;d consider migrating from the already built-in `choose-tree -Zw` command.
评论 #31309989 未加载
评论 #31309977 未加载
yourapostasyabout 3 years ago
I&#x27;m still trying to assemble a way to put together the pieces to not only return to tmux sessions after detaching, but after detaching <i>and the underlying server reboots</i>. Playing around with CRIU, but trying to make it all automagic with nested PIDs, restore the screens and shell history buffers just how I left them, and implement the common use case of automatically re-establishing ssh connections remains a challenge.
评论 #31311796 未加载
silves89about 3 years ago
Another reason for using tmux: never worry about changing your muscle memory for splits and nav ever again.<p>I&#x27;ve been using tmux for five or six years. In that time I&#x27;ve used Linux and MacOS and several different terminals. But how I navigate around a terminal has stayed the same thanks to tmux.<p>Another reason: put complex tmuxinator configs in source control and start up a bunch of stuff for your project with a single command.
评论 #31312575 未加载
pkruminsabout 3 years ago
Once I discovered fzf a couple of years ago, I instantly knew it was the future of shell. My entire workflow is now driven by fzf. I use it together with bash, vim, cd (and &quot;z&quot; command), even mkdir (autocomplete from &quot;words&quot; file).
评论 #31339866 未加载
cryptonectorabout 3 years ago
I&#x27;ve a much simpler solution. I nest tmux sessions. In the top-level session every window is named the same as the session that is attached in it. I&#x27;ve two different prefix keys: ^T for the top-level, and ^A for the level below. Plus I&#x27;ve a one-liner (well, shell function) for mapping PIDs to session &amp; window. Plus a script to create new nested sessions, and a script start $EDITOR in a window of the current session (with the window named after the file being edited). Plus I&#x27;ve a half-baked script to set up this environment, with one nested tmux per-project.<p>This allows me to have a very well-organized way of working over ssh.
stevebmarkabout 3 years ago
I really like iTerm2 for Mac. The tabs, splits, and navigation, are intuitive and powerful. I haven’t found a need for tmux. I use fzf for file finding, it looks like this is use is a subset of iTerm2 capabilities
评论 #31310297 未加载
评论 #31312027 未加载
kentorabout 3 years ago
Video is cut off on mobile
评论 #31309734 未加载
评论 #31308869 未加载
clvxabout 3 years ago
Nice, I just extended this to kill a session too. This is great.
1vuio0pswjnm7about 3 years ago
It is interesting how much people use tmux for working in several interactive shells at once. I tend to use tmux more for running servers in detached windows.
评论 #31308867 未加载
评论 #31309229 未加载
maheartabout 3 years ago
I&#x27;ve wanted something like this but for &quot;screen&quot; for a long time. Does anyone have such a solution?
cptnapalmabout 3 years ago
Could someone, in brief, tell me what fzf actually is. The man page is uninformative.