brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: tmux attach -c changes the folder new tmux windows start in

Tmux
~/tips/tip-tmux-attach-workdir

tmux attach -t main -c ~/projects/site

Points a running session at a new project folder.

A tmux session remembers the folder it was created in, and new windows open there. When I move on to another project, I’d rather change that folder than start a new session.

tmux attach -t main -c ~/projects/site

-c sets the working directory of the session as you attach. Panes that are already open stay where they are. Every window you open afterwards with Ctrl-b c starts in ~/projects/site.

When you start a session you can set it straight away:

tmux new -s site -c ~/projects/site

To check which folder a session uses, print the format:

tmux display -p -t site '#{session_path}'

A key binding that opens windows in the current pane’s folder, like new-window -c "#{pane_current_path}", wins over this, because it passes its own -c. So if your config has one, the session folder only matters for windows created some other way.

Further reading: tmux manual page (OpenBSD)

More Tmux tips tmux new -d -s report -x 200 -y 50 'top' tmux wait-for build-done set -g allow-passthrough on tmux kill-server Ctrl-b [ All Tmux tips (125) All topics

Link