diff --git a/README.md b/README.md index c1986d4..26aac02 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186). -_1295 TILs and counting..._ +_1296 TILs and counting..._ --- @@ -1161,6 +1161,7 @@ _1295 TILs and counting..._ - [Adjusting Window Pane Size](tmux/adjusting-window-pane-size.md) - [Break Current Pane Out To Separate Window](tmux/break-current-pane-out-to-separate-window.md) - [Change Base Directory Of Existing Session](tmux/change-base-directory-of-existing-session.md) +- [Change Base Directory Without Detaching](tmux/change-base-directory-without-detaching.md) - [Change The Default Prefix Key](tmux/change-the-default-prefix-key.md) - [Create A Named tmux Session](tmux/create-a-named-tmux-session.md) - [Create A New Session In A New Server](tmux/create-a-new-session-in-a-new-server.md) diff --git a/tmux/change-base-directory-without-detaching.md b/tmux/change-base-directory-without-detaching.md new file mode 100644 index 0000000..57d7989 --- /dev/null +++ b/tmux/change-base-directory-without-detaching.md @@ -0,0 +1,25 @@ +# Change Base Directory Without Detaching + +In [Change Base Directory Of Existing +Session](change-base-directory-of-existing-session.md), I described how you can +detach from an existing tmux session and re-attach with a new base directory +specified. + +We can do nearly the same thing within the current tmux session without first +detaching. The command is going to look much the same, but we will execute it +from the tmux command prompt. + +Start the prompt by hitting `:` and then enter the following command: + +``` +:attach-session -t . -c /path/to/base/directory +``` + +Here the `-t` specifies what session we are going to attach to. By giving it +`.`, we tell it that we want to attach to the current session. The `-c` +specifies our new base directory. + +Hit enter and then try opening a new window or pane to see that the new base +directory has taken effect. + +[source](https://stackoverflow.com/questions/27307815/how-do-i-change-the-starting-directory-of-a-tmux-session#comment99821047_54444853)