CLI -- tmux.

Most of these examples will use example session name "renard". But using a tmux session number should work also.

From outside tmux.

Start a new session:
  tmux

Start a new session called renard.
  tmux new-session -s renard

List sessions.
  tmux ls

Attach to a session named renard.
  tmux attach -t renard

Kill the session called renard.
  tmux kill-session -t renard

From inside a tmux session.

Start a new tmux session.
  [prefix]:new

Start a new tmux session called renard.
  [prefix]:new -s renard

Detach from a session.
  [prefix]:detach

Rename a session to give it the name renard.
  [prefix]:rename-session renard

Kill session named renard.
  [prefix]:kill-session -t renard

Go to session list and kill session renard.
  - First move to a session other than renard, otherwise 
    you will exit tmux when renard is killed.
  [prefix]s
  [prefix]:kill-session -t renard


Shortcuts to use from inside a tmux session.

[prefix]s    Go to a list of sessions from which we can switch to a new session.
[prefix]%    Split window into vertical panes.
[prefix]"    Split window into horizontal panes.
[prefix],    name a window

/home/pat/.tmux.conf

# set -g default-terminal "screen-256color"

unbind C-b
set-option -g prefix C-j

## The following makes it that we can send C-j to the application 
## running inside tmux by doing C-[jj].
bind-key C-j send-prefix

## Use tmux vi-like keys for tmux copy mode.
setw -g mode-keys vi

## Use vim keys to move amuong panes.
bind h select-pane -L
bind l select-pane -R
bind k select-pane -U
bind j select-pane -D

bind H resize-pane -L 5
bind J resize-pane -D 5
bind K resize-pane -U 5
bind L resize-pane -R 5

## Newly created windows and panes open in current directory.
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"

############################################
## May be useful in future.

## use UTF-8
# set -g utf8
# set-window-option -g utf8 on

## shorten command delay
# set -sg escape-time 1
############################################