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 -s 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 v       # vert
48     C-b n       # horiz
49     C-b hkjl    # navigation
50     C-b HJKL    # resize
51     C-b o       # next window
52     C-b x       # close pane
53
54     C-b { or }  # move windows around
55
56 ### Windows
57
58     C-b c       # New window
59     C-b 1       # Go to window 1
60
61 ### Detach/attach
62
63     C-b d       # Detach
64     C-b ( )     # Switch through sessions
65     $ tmux attach
66
67 ### Niceties
68
69     C-b t    # Time
70
71 ## Status formats
72
73 ```
74 setw -g window-status-format `#[fg=8,bg=default]#I`
75 ```
76
77 See `message-command-style` in the man page.
78
79 ### Attribute/colors
80
81 | `#[fg=1]` | standard color |
82 | `#[fg=yellow]` | yellow |
83 | `#[bold]` | bold |
84 | `#[fg=colour240]` | 256 color |
85 | `#[fg=default]` | default |
86 | `#[fg=1,bg=2]` | combinations |
87 | `#[default]` | reset |
88
89 ### Colors
90
91  * `black` `red` `green` `yellow` `blue` `magenta` `cyan` `white`
92  * `brightred` (and so on)
93  * `colour0` ... `colour255`
94  * `#333` (rgb hex)
95
96 ### Attributes
97
98  * `bold` `underscore` `blink` `noreverse` `hidden` `dim` `italics`
99
100 ### Variables
101
102 | `#(date)` | shell command |
103 | `#I` | window index |
104 | `#S` | session name |
105 | `#W` | window name |
106 | `#F` | window flags |
107 | `#H` | Hostname |
108 | `#h` | Hostname, short |
109 | `#D` | pane id |
110 | `#P` | pane index |
111 | `#T` | pane title |
112
113 ## Options
114
115     set -g status-justify [left|centre|right]
116     set -g status-left '...'
117
118     setw -g window-status-style
119     setw -g window-status-activity-style
120     setw -g window-status-bell-style
121     setw -g window-status-content-style
122     setw -g window-status-current-style
123     setw -g window-status-last-style
124
125     setw -g window-status-format
126     setw -g window-status-current-format
127
128     setw -g window-status-separator