mirror of
https://github.com/jbranchaud/til
synced 2026-01-02 22:58:01 +00:00
Add Change Base Directory Without Detaching as a tmux TIL
This commit is contained in:
@@ -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)
|
||||
|
||||
25
tmux/change-base-directory-without-detaching.md
Normal file
25
tmux/change-base-directory-without-detaching.md
Normal file
@@ -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 `<prefix>:` 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)
|
||||
Reference in New Issue
Block a user