50

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

6 Answers 6

32

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
  • 1
    nope nothing. maybe tmux is looking for the wrong file. my tmux.conf is in my home directory and is hidden.
    – nopcorn
    Commented Apr 6, 2011 at 13:42
  • 2
    tmux -f ~/.tmux.conf Commented Apr 6, 2011 at 18:26
  • 39
    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. Commented Apr 6, 2011 at 18:38
  • 16
    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!
    – nopcorn
    Commented 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
    Commented Feb 17, 2016 at 19:53
98

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
  • 18
    Release pressed keys in Step 1 -> This is what I was missing. Thanks!
    – gabbar0x
    Commented May 22, 2019 at 13:54
  • 1
    @byxor this question has precisely to do with splitting panes. The answer is works for me.
    – Jepper
    Commented Sep 7, 2019 at 16:33
  • 1
    This should be the accepted answer - huge help (tmux noob here)
    – J.Wolfe
    Commented Dec 14, 2022 at 2:04
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
    Commented Jan 14, 2022 at 11:56
0

I was unable to get any of the tmux functions to work until I installed emacs

sudo apt install emacs  

By default, in Bash, emacs mode is enabled. If it is not enabled you can run this in your shell:

set -o emacs

This allows you to move the cursor in the shell faster than using the arrow keys alone. Specific command key chords/combinations can be used, like so:

  • Ctrl-a: move cursor to the beginning of the line
  • Ctrl-e: move cursor to the end of the line
  • Meta-b: (or Alt-b), move backward one word
  • Meta-f: (or Alt-f), move forward one word
  • Ctrl-u: Cut from cursor to beginning of line
  • Ctrl-k: Cut from cursor to end of line
  • Ctrl-w: Cut previous word
  • Ctrl-y: Paste what you just cut with Ctrl-u, Ctrl-k, or Ctrl-w
  • Ctrl-_: Undo last cut (may not work in all terminals)

Now you can navigate the shell like a pro!

0

I know this is not necessarily the right place, but I had been using https://github.com/rse/stmux thinking it was tmux. It turns out the default activator key on stmux isn't CTRL+B but CTRL+A (and the "A" key turns out to be quite far away from B/C on an AZERTY keyboard ^^")

so CTRL+A, release and then press your keys like K for kill

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .