As usual, I want to learn something so I'm going to write about it. Hopefully someone finds this useful!
Installing TMUX
TMUX is available in most Linux distributions, and can be installed using the package manager for your distribution. Install Here.
Starting TMUX
To start a new TMUX session, simply run tmux
in your terminal.
You will now be in a new TMUX session. You can tell that you are in a TMUX session because a status bar will appear at the bottom of the terminal. The status bar typically includes information about the current TMUX session, such as the current window and pane, the hostname, and the time. In a TMUX session, the status bar at the bottom of the terminal will indicate that you are in a TMUX session, but it does not contain a logo.
Common Configuration Changes
Edit ~/.tmux.conf
and from below what you want! On TMUX boot, ~/.tmux.conf
is executed as a way of saving your configuration. This does mean if this script becomes complex, it will take longer to load tmux
so don't go crazy.
To load changes: tmux source-file ~/.tmux.conf
- Copy Paste!
# Install XClip
sudo apt install xclip
# Confirm
xclip
- Status Bar Customization
# Change the color of the status bar
set-option -g status-bg yellow
set-option -g status-fg black
# Change the position of the status bar to the top of the terminal window
set-option -g status-position top
# Display the date and time in the status bar
set-option -g status-right '%F %T'
# Improve term colors
set -g default-terminal 'screen-256color'
- Increase history buffer, default is
2000
lines. I'd like to be able to dump many more and be able to copy them afterwards!
# Set scrollback buffer to 10000
set -g history-limit 10000
- Change the default 'action' button from
Ctrl+b
because it sucks.
# Make it space!
unbind C-b
set-option -g prefix C-Space
- Move around panes with just arrow keys: T
# Create a keybinding to switch between windows using "Alt + Arrows"
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
The timeout after the prefix key makes moving around to different panes and re-running a command from history (up arrow + enter) painful. Instead, this avoids pressing the prefix key at all making it much faster. 6. Rebind the unnatural horizontal and vertical split hotkeys to something else.
bind | split-window -h
bind _ split-window -v
unbind '"'
unbind %
Hotkeys
Keybinding | Action |
---|---|
Ctrl + Space, d | detach from current session |
Ctrl + Space, s | list sessions |
tmux attach-session -t [session_name/session_id] | attach to a specific session |
tmux new-session -s [session_name] | create a new session |
Keybinding | Action |
---|---|
Ctrl + Space, _ | split pane horizontally |
Ctrl + Space, | |
Alt + Left Arrow | switch to the left pane |
Alt + Right Arrow | switch to the right pane |
Alt + Up Arrow | switch to the upper pane |
Alt + Down Arrow | switch to the lower pane |
[Hold Ctrl + Space] + Arrow Keys | Resize currently selected pane within window |
End Result
My own terminal involves some hipster shit like zsh and dracula theming, but here it is with some silly random printouts: