37

Holding Ctrl and B followed by another command key usually gives me nothing.  I have no .conf file so I'm not overwriting it.

4 Answers 4

26

This is what I use for my configuration and I have Ctrl+A as prefix key.

set -g prefix ^a
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
unbind %
bind | split-window -h
bind - split-window -v
bind N break-pane
# Set status bar
set -g status-bg black
set -g status-fg white
# Highlight active window
set-window-option -g window-status-current-bg blue

# Set window notifications
setw -g monitor-activity on
set -g visual-activity on

# Automatically set window title
setw -g automatic-rename

Test it by pressing Ctrl+A, then after that ?.

6
  • nope nothing. maybe tmux is looking for the wrong file. my tmux.conf is in my home directory and is hidden.
    – n0pe
    Apr 6, 2011 at 13:42
  • 2
    tmux -f ~/.tmux.conf Apr 6, 2011 at 18:26
  • 34
    May be your terminal or DE also has the same shortcut. However, I hope you are not just pressing Ctrl+A. Basically, you have to press Ctrl+A and then release keys, then press "?" or any command. Apr 6, 2011 at 18:38
  • 15
    Ah. Well now I feel like an idiot. Yup that was it, I didn't know you had to release keys. Wow, I need sleep :) Thanks for helping!
    – n0pe
    Apr 6, 2011 at 18:46
  • 1
    This is all about time... first time i also wonder why the hell its not working... you won't believe, i literally type this on terminal ctrl+b kinda funny... but this post clear doubt.. Just hit ctrl+b and right after that hit next key, that will be your command, c, n, p etc... cool trick
    – Satish
    Feb 17, 2016 at 19:53
75

I think this deserves a clear visible answer which is hidden in form of a comment under the first answer.

Assuming the default tmux configuration is being used, novice tmux users please follow the instructions below to split the pane

To split the pane horizontally

  1. Press Ctrl+B
  2. Release pressed keys in Step 1
  3. Press "  (on many keyboards, this is Shift+')

To split the pane vertically

  1. Press Ctrl+B
  2. Release pressed keys in Step 1
  3. Press %  (on many keyboards, this is Shift+5)

The articles I found and referenced below mention [CTRL B] + [%] or [CTRL B] + ["] or Ctrl+b " which implies that we have to press all the keys together but none mentions the important part of releasing the pressed Ctrl + whatever key before pressing the another key in sequence in the command to see the desired action.

3
  • 7
    This question has nothing to do with splitting panes. Why have you answered with these examples?
    – byxor
    Aug 9, 2017 at 15:49
  • 13
    Release pressed keys in Step 1 -> This is what I was missing. Thanks!
    – gabbar0x
    May 22, 2019 at 13:54
  • 1
    @byxor this question has precisely to do with splitting panes. The answer is works for me.
    – Jepper
    Sep 7, 2019 at 16:33
2

You can type the command tmux detach to detach from the session. type tmux list-sessions to get a list of active sessions tmux list-sessions 0: 1 windows (created Wed Feb 21 12:53:31 2018) [157x75] 1: 1 windows (created Wed Feb 21 12:55:05 2018) [157x75] tmux attach-session -t will attach you to the session Example: tmux attach-session -t 0

0
1

Basic tmux commands

tmux                         # start new
tmux new -s myname           # start new with session name
tmux a                       #  (or at, or attach)
tmux a -t myname             # attach to named
tmux ls                      # list sessions
tmux kill-session -t myname  # kill session
tmux ls | grep : | cut -d. -f1 | awk '{print substr($1, 0, length($1)-1)}' | xargs kill # Kill all the tmux sessions:

Tmux config file to make settings

cat << EOT > ~/.tmux.conf
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
set -g base-index 1
set-window-option -g automatic-rename on
set-option -g set-titles on
set -g status-keys vi
set -g history-limit 10000
setw -g mode-keys vi
setw -g monitor-activity on
bind-key v split-window -h
bind-key s split-window -v
#***synchronize-panes***
bind-key x set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
EOT

Navigate between split panes

  • Ctrl + a, x: to toggle synchronization mode.
  • Ctrl + a, >: to go to right pane
  • Ctrl + a, <: to go to left pane
  • Ctrl + a, d: detach tmux and go back to original shell.

Note: Press Ctrl+a, hand-off keyboard, then press x or < or < d. No need to long press bind-key which is Ctrl+a.

Source

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jan 14 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.