Skip to content

Commit 03604ee

Browse files
committed
Add Change Base Directory Without Detaching as a tmux TIL
1 parent fd3da2c commit 03604ee

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010

1111
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
1212

13-
_1295 TILs and counting..._
13+
_1296 TILs and counting..._
1414

1515
---
1616

@@ -1161,6 +1161,7 @@ _1295 TILs and counting..._
11611161
- [Adjusting Window Pane Size](tmux/adjusting-window-pane-size.md)
11621162
- [Break Current Pane Out To Separate Window](tmux/break-current-pane-out-to-separate-window.md)
11631163
- [Change Base Directory Of Existing Session](tmux/change-base-directory-of-existing-session.md)
1164+
- [Change Base Directory Without Detaching](tmux/change-base-directory-without-detaching.md)
11641165
- [Change The Default Prefix Key](tmux/change-the-default-prefix-key.md)
11651166
- [Create A Named tmux Session](tmux/create-a-named-tmux-session.md)
11661167
- [Create A New Session In A New Server](tmux/create-a-new-session-in-a-new-server.md)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Change Base Directory Without Detaching
2+
3+
In [Change Base Directory Of Existing
4+
Session](change-base-directory-of-existing-session.md), I described how you can
5+
detach from an existing tmux session and re-attach with a new base directory
6+
specified.
7+
8+
We can do nearly the same thing within the current tmux session without first
9+
detaching. The command is going to look much the same, but we will execute it
10+
from the tmux command prompt.
11+
12+
Start the prompt by hitting `<prefix>:` and then enter the following command:
13+
14+
```
15+
:attach-session -t . -c /path/to/base/directory
16+
```
17+
18+
Here the `-t` specifies what session we are going to attach to. By giving it
19+
`.`, we tell it that we want to attach to the current session. The `-c`
20+
specifies our new base directory.
21+
22+
Hit enter and then try opening a new window or pane to see that the new base
23+
directory has taken effect.
24+
25+
[source](https://stackoverflow.com/questions/27307815/how-do-i-change-the-starting-directory-of-a-tmux-session#comment99821047_54444853)

0 commit comments

Comments
 (0)