This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
linux:tmux [2017/10/17 11:16] admin |
linux:tmux [2017/10/17 11:19] (current) admin |
||
---|---|---|---|
Line 98: | Line 98: | ||
Before you can do that, though, you need to know how to switch panes, don’t you? To move from the bottom, right-side pane to the top, right-side pane: | Before you can do that, though, you need to know how to switch panes, don’t you? To move from the bottom, right-side pane to the top, right-side pane: | ||
+ | <code bash> | ||
CTRL+B <UP ARROW> | CTRL+B <UP ARROW> | ||
+ | </code> | ||
+ | |||
Same prefix, new suffix to the command. This one makes a bit more sense; to move up, use the up-arrow. Now type the command to fire up your tests. | Same prefix, new suffix to the command. This one makes a bit more sense; to move up, use the up-arrow. Now type the command to fire up your tests. | ||
Line 105: | Line 108: | ||
Here is my edit pane: | Here is my edit pane: | ||
- | tmux_edit_pane | + | {{ :linux:tmux_edit_pane-530x390.png |}} |
OK, the edit pane is done. Pro tip: If you are using tmux 1.8, you can toggle the curent pane into full-screen by typing: | OK, the edit pane is done. Pro tip: If you are using tmux 1.8, you can toggle the curent pane into full-screen by typing: | ||
+ | <code bash> | ||
CTRL+B z | CTRL+B z | ||
+ | </code> | ||
+ | |||
I LUUUUUV this feature, because it means I can full-screen my tests when they are failing and navigate around that pane more easily, then return it to its original size when done. | I LUUUUUV this feature, because it means I can full-screen my tests when they are failing and navigate around that pane more easily, then return it to its original size when done. | ||
Quickly now, I’ll show you how to add a window so you can fire up other services related to your app in the tmux session. To add a new window: | Quickly now, I’ll show you how to add a window so you can fire up other services related to your app in the tmux session. To add a new window: | ||
+ | <code bash> | ||
CTRL+B c | CTRL+B c | ||
+ | </code> | ||
+ | |||
You are now in a pane-free (HA!) terminal and the status bar shows two windows (0 and 1). Fire up the rails console or whatever you like here. | You are now in a pane-free (HA!) terminal and the status bar shows two windows (0 and 1). Fire up the rails console or whatever you like here. | ||
- | tmux_new_window | + | {{ :linux:tmux_new_window-530x389.png |}} |
Add as many windows as you like using that same key combination. When you want to switch between windows 0 and 1, type: | Add as many windows as you like using that same key combination. When you want to switch between windows 0 and 1, type: | ||
+ | <code bash> | ||
CTRL+B <window number> | CTRL+B <window number> | ||
+ | </code> | ||
+ | |||
where is 0 or 1. | where is 0 or 1. | ||
Now you can jump back and forth at your heart’s consent. | Now you can jump back and forth at your heart’s consent. | ||
- | The End is Near | + | ===== The End is Near ===== |
The last thing I’ll mention is how you detach from and end a session. When you are in a session, you are “attached” to it. The tmux command creates a new session and attaches the current terminal. To detach, type: | The last thing I’ll mention is how you detach from and end a session. When you are in a session, you are “attached” to it. The tmux command creates a new session and attaches the current terminal. To detach, type: | ||
+ | <code bash> | ||
CTRL+B d | CTRL+B d | ||
+ | </code> | ||
+ | |||
You’ll see something like [detached] and you’ll be back at your no-status-bar, regular, old terminal. If you type tmux ls, you will see a list of sessions: | You’ll see something like [detached] and you’ll be back at your no-status-bar, regular, old terminal. If you type tmux ls, you will see a list of sessions: | ||
- | tmux_ls | + | {{ :linux:tmux_ls.png |}} |
All the stuff you had running in that session is still cruising right along. You can reattach to it by typing: | All the stuff you had running in that session is still cruising right along. You can reattach to it by typing: | ||
+ | <code bash> | ||
tmux attach -t 0 | tmux attach -t 0 | ||
+ | </code> | ||
+ | |||
where -t stands for “target” and 0 is the session name. Now, go ahead and detach again. | where -t stands for “target” and 0 is the session name. Now, go ahead and detach again. | ||
To end/kill the session, type | To end/kill the session, type | ||
+ | <code bash> | ||
tmux kill-session -t 0 | tmux kill-session -t 0 | ||
+ | </code> | ||
+ | |||
This will end the session, so if you do another tmux ls, you will see zero sessions running. By the way, if you exit out of all the windows in a session, the session will exit as well. | This will end the session, so if you do another tmux ls, you will see zero sessions running. By the way, if you exit out of all the windows in a session, the session will exit as well. | ||
- | Next Steps | + | ===== Next Steps ===== |
This article just skims the surface of what tmux can do for you. However, you can apply what you learned today and be more productive in your development environment without investing another second of time learning about tmux. | This article just skims the surface of what tmux can do for you. However, you can apply what you learned today and be more productive in your development environment without investing another second of time learning about tmux. | ||