terminal multiplexer tmux gnu screen

 
-- what are tmux, gnu screen 
 
tmux amd gnu screen are the famous terminal multiplexers. it's just a way to tabulate separate terminal sessions inside a window. you can attach/detach your tty so if you accidentally close your putty or simply want to stop and resume later from remote location, you can. 
 
tmux is the latest defacto standard. 
 
-- customize tmux, screen config 
 
you can boundlessly configure both (1) key bind, (2) presentation via your local config. 
 
####################### 
####  ~/.screenrc  #### 
####################### 
 
vbell off 
autodetach on 
startup_message off 
defscrollback 1000 
hardstatus alwayslastline "%{= gk} %{gW} %-w%{= wk}%n %t%{-}%+w %=%{gk} " 
escape ^Tt 
defbce "on" 
term xterm-256color 
shell bash 
shelltitle "$ |bash" 
 
 
===>  the default control key is 'a' but here we changed it to 't' because 'a' would conflict with bash/emacs 
 
ctr-t ?      # help menu 
ctr-t c      # a new tab 
ctr-t del    # prev tab 
ctr-t n      # next tab 
ctr-t [0-9]  # jump to the tab N 
ctr-t '      # it will ask you to pick a tab number to move to 
ctr-t k      # kill the tab 
ctr-t d      # detach the current screen 
ctr-t "      # list tabs, and you can select one to move to 
screen -r    # resume 
screen -l    # list screen sessions 
screen -d    # detach a screen session 
 
 
 
######################### 
####  ~/.tmux.conf   ####     https://tmuxcheatsheet.com/ 
######################### 
 
tmux -u    # utf8 
tmux ls 
tmux attach [-t sessionName] 
 
 
ctr-t $       # rename session 
ctr-t d       # detach from session 
ctr-t s       # move btwn sessions 
 
ctr-t c       # create new window 
ctr-t n       # move to next window 
ctr-t p       # move to prev window 
ctr-t ,       # rename current window 
ctr-t w       # list current window 
ctr-d         # exit window 
ctr-t &       # kill current window 
ctr-t N       # goto window N = [0,9] 
ctr-t 'N      # goto window N = any integer 
 
ctr-t x       # kill current pane 
 
ctr-t %       # vertical split 
ctr-t "       # horizontal split 
ctr-t q       # shows pane number 
alt-arrow     # move btwn panes (customized) 
ctr-u/d/l/r   # resize panes (customized) 
 
ctr-[         # copy mode (ESC to escape) 
 
ctr-t : source-file /absolute/path/to/your/.tmux.conf 
 
 
------------------------ .tmux.conf 
 
# change the prefix key from Ctr-b to Ctr-t 
unbind-key C-b 
set-option -g prefix C-t 
bind-key C-T send-prefix 
 
#  #H  hostname of local host 
#  #I  current window index 
#  #P  current pane index 
#  #S  session name 
#  #T  current window title 
#  #W  current window name 
 
set-option -g allow-rename off 
set-option -g set-titles on 
set-option -g set-titles-string '#S (#H) window[#I]:#W pane:#P' 
set-window-option -g monitor-activity on 
set-window-option -g automatic-rename on 
bind-key c new-window -n 'name' 
 
# control-shift-left/right/up/down arrow to move a window position 
 
# start window counter at 1 
# set -g base-index 1 
 
# lowers delay time between prefix key and other keys 
set -sg escape-time 1 
 
# use emacs style behavior in copy mode 
set-window-option -g mode-keys emacs 
 
# enable 256 color 
# set -g default-terminal "screen-256color" 
 
# set the scrollback limit for each pane 
set -g history-limit 5000 
 
# renumber windows when some have been closed 
bind-key C-r run "for i in $(tmux lsw|awk -F: '{print $1}'); do tmux movew -s \$i; done"  # C-r means control-r 
 
set-option -g renumber-windows on 
# bind z move-window -r 
 
# UTF-8 character support in status bar 
set-option -g status on 
setw -g utf8 on 
set-option -g status-utf8 on 
 
# set color for status bar 
set-option -g status-bg colour250 
set-option -g status-fg brightblack 
set-option -g status-attr bright 
 
# set window list colors - red for active and cyan for inactive 
set-window-option -g window-status-fg black 
set-window-option -g window-status-bg white 
set-window-option -g window-status-attr bright 
set-window-option -g window-status-current-fg white 
set-window-option -g window-status-current-bg blue 
set-window-option -g window-status-current-attr bright 
 
set -g status-left-length 70 
set -g status-left "[#S]" 
 
# time messages remain in the status bar (in ms) 
set-option -g display-time 3000 
 
# switch panes using Alt-arrow without prefix 
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 
 
 
# to resize panes 
bind-key d resize-pane -D 5 
bind-key u resize-pane -U 5 
bind-key l resize-pane -L 5 
bind-key r resize-pane -R 5 
 

  1. 2013-11-24 23:52:41 |
  2. Category : unix
  3. Page View:

Google Ads