OSDN Git Service

Regular updates
[twpd/master.git] / tmux.md
1 ---
2 title: tmux
3 category: CLI
4 ---
5
6 ### Commands
7
8     $ tmux
9       -u        # UTF8 mode
10       -S ~/.tmux.socket
11
12 #### Sessions
13
14     $ tmux new
15     $ tmux new -s session_name
16
17     $ tmux attach # Default session
18     $ tmux attach -t session_name
19
20     $ tmux switch -t session_name
21
22     $ tmux ls     # List sessions
23
24     $ tmux detach
25
26 #### Windows
27
28     $ tmux new-window
29
30 ### Help
31
32     C-b ?
33
34 ### Scrolling
35
36     C-b [       # Enter scroll mode then press up and down
37
38 ### Copy/paste
39
40     C-b [       # 1. Enter scroll mode first.
41     Space       # 2. Start selecting and move around.
42     Enter       # 3. Press enter to copy.
43     C-b ]       # Paste
44
45 ### Panes
46
47     C-b %       # vert
48     C-b "       # horiz
49     C-b hkjl    # navigation
50     C-b HJKL    # resize
51     C-b o       # next window
52     C-b q       # show pane numbers
53     C-b x       # close pane
54
55     C-b { or }  # move windows around
56
57 ### Windows
58
59     C-b c       # New window
60     C-b 1       # Go to window 1
61     C-b n       # Go to next window
62     C-b p       # Go to previous window
63     C-b w       # List all window
64
65 ### Detach/attach
66
67     C-b d       # Detach
68     C-b ( )     # Switch through sessions
69     $ tmux attach
70
71 ### Niceties
72
73     C-b t    # Time
74
75 ## Status formats
76
77 ```
78 setw -g window-status-format `#[fg=8,bg=default]#I`
79 ```
80
81 See `message-command-style` in the man page.
82
83 ### Attribute/colors
84
85 | `#[fg=1]` | standard color |
86 | `#[fg=yellow]` | yellow |
87 | `#[bold]` | bold |
88 | `#[fg=colour240]` | 256 color |
89 | `#[fg=default]` | default |
90 | `#[fg=1,bg=2]` | combinations |
91 | `#[default]` | reset |
92
93 ### Colors
94
95  * `black` `red` `green` `yellow` `blue` `magenta` `cyan` `white`
96  * `brightred` (and so on)
97  * `colour0` ... `colour255`
98  * `#333` (rgb hex)
99
100 ### Attributes
101
102  * `bold` `underscore` `blink` `noreverse` `hidden` `dim` `italics`
103
104 ### Variables
105
106 | `#(date)` | shell command |
107 | `#I` | window index |
108 | `#S` | session name |
109 | `#W` | window name |
110 | `#F` | window flags |
111 | `#H` | Hostname |
112 | `#h` | Hostname, short |
113 | `#D` | pane id |
114 | `#P` | pane index |
115 | `#T` | pane title |
116
117 ## Options
118
119     set -g status-justify [left|centre|right]
120     set -g status-left '...'
121
122     setw -g window-status-style
123     setw -g window-status-activity-style
124     setw -g window-status-bell-style
125     setw -g window-status-content-style
126     setw -g window-status-current-style
127     setw -g window-status-last-style
128
129     setw -g window-status-format
130     setw -g window-status-current-format
131
132     setw -g window-status-separator