AIX
I’ve started using tmux instead of screen lately. My version of screen (no longer maintained) doesn’t do vertical window splits where tmux does.
Just like screen, in AIX, I use backtick as my C-a. Backtick-c will create a new window. Backtick-d will disconnect the sessions. The command “tmux attach” will re-attach to my sessions and it remembers all my window splits which I never could do in screen.
Here is my AIX .tmux.conf cobbled together from google searches.
# Set option key set-option -g prefix ` # Set status bar set -g status-bg black set -g status-fg white set -g status-left "#[fg=green]#H" unbind % # Remove default binding since were replacing bind | split-window -h bind - split-window -v #set-option -g mouse-select-pane on bind ` send-keys ` bind e send-keys "smitty etherchannel" bind a send-keys "netstat -v | grep -i activ" bind s send-keys "stty erase ^?" # basic settings set-window-option -g mode-keys vi # vi key set-option -g status-keys vi set-window-option -g utf8 on # utf8 support set-window-option -g mode-mouse off # disable mouse # copy mode to escape key unbind [ bind Escape copy-mode set-option -g mouse-select-pane off # window title set-option -g set-titles on set-option -g set-titles-string '#S:#I.#P #W' # window number,program name,active (or not) set-window-option -g automatic-rename on # auto name # messages #set-window-option -g mode-bg magenta #set-window-option -g mode-fg black #set-option -g message-bg magenta #set-option -g message-fg black # No visual activity set -g visual-activity off set -g visual-bell off # status bar set-option -g status-utf8 on set-option -g status-justify right set-option -g status-bg black set-option -g status-fg cyan set-option -g status-interval 5 set-option -g status-left-length 30 set-option -g status-left '#[fg=magenta]> #[fg=blue,bold]#T#[default]' set-option -g status-right '#[fg=cyan]>> #[fg=blue,bold]###S #[fg=magenta]%R %m-%d#(acpi | cut -d ',' -f 2)#[default]' set-option -g visual-activity on set-window-option -g monitor-activity on set-window-option -g window-status-current-fg white # clock set-window-option -g clock-mode-colour cyan set-window-option -g clock-mode-style 24 # bind keys for synchronize-panes bind -n C-x setw synchronize-panes on bind -n M-x setw synchronize-panes off |
And this is what one of my tmux screens look like: –
Update :
- backtick + left/right/up/down will move to different panes
- backtick + 0/1/2/etc will move to different screens
- backtick + | will create a vertical split pane
- backtick + – will create a horizontal split pane
- Control-x will turn pane sync on to allow input to all panes at the same time
- Alt-x will turn pane sync off
Cygwin
Update 2 :
If you are using tmux within a cygwin bash shell, you might find the Ctrl-C interrupt doesn’t work if you’ve set your terminal to vt200 like I did in .tmux.conf:
set -g default-terminal vt220 |
I fixed this by making sure you cygwin shell settings also have vt220 set as the Terminal Type.
Here is my Cygwin ./tmux.conf file. Notice I switched back to using the CTRL-A bind key, rather that backtick used previously.
# Appearance customization set -g status-bg black set -g status-fg white set -g window-status-current-fg green # Custom modifier key unbind-key C-b set -g prefix C-a bind-key C-a send-prefix # Terminal improvements set -g terminal-overrides "xterm*:XT:smcup@:rmcup@" set-window-option -g automatic-rename on set-option -g set-titles on set -g mouse on set -g default-terminal xterm-256color set -g status-keys vi set -g history-limit 10000 setw -g mode-keys vi unbind-key -T copy-mode-vi v bind-key -T copy-mode-vi 'v' send -X begin-selection # Begin selection in copy mode. bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle # Begin selection in copy mode. bind-key -T copy-mode-vi 'y' send -X copy-selection # Yank selection in copy mode. # Start numbering at 1 instead of 0 set -g base-index 1 # Clear scrollback buffer bind l clear-history # Custom key bindings to split the window bind-key v split-window -h bind-key s split-window -v # Reload tmux config bind r source-file ~/.tmux.conf # No delay for escape key press set -sg escape-time 0 # Shift arrow to switch panes bind -n S-Left select-pane -L bind -n S-Right select-pane -R bind -n S-Up select-pane -U bind -n S-Down select-pane -D # Control arrow to create panes bind -n C-Down split-window -v bind -n C-Up split-window -v -b bind -n C-Right split-window -h bind -n C-Left split-window -h -b # Easier window navigation bind -n C-Tab next-window bind -n C-S-Tab previous-window bind -n C-S-Left previous-window bind -n C-S-Right next-window # Ctrl + Alt + Left/Right to move windows bind-key -n C-M-Left swap-window -t -1 bind-key -n C-M-Right swap-window -t +1 # Copy to cygwin clipboard bind -n C-t run "tmux save-buffer - > /dev/clipboard" # Kill tabs quicker bind-key x kill-pane # Plugins run-shell ~/.tmux-plugins/resurrect/resurrect.tmux |
Pane Resizing
Update 3 :
If you split windows horizontally or vertically, you might want to re-balance the sizes since the first split will half your first window, and the second split will half the second window, leaving window 1 bigger than windows 2 and 3.
You can do this with:
CTRL-A :select-layout even-vertical
or
CTRL-A :select-layout even-horizontal
Or you can toggle through the pre-defined pane layouts using C-a SPACE