分页: 1 / 1

tmux

发表于 : 2010-07-18 18:42
millenniumdark
screen的一個現代替代

Re: tmux

发表于 : 2010-07-18 18:49
eexpress
如果不如dtach简单。就没必要转了。估计按键难得熟悉。

Re: tmux

发表于 : 2010-07-18 19:06
adagio
怎么个现代法?

Re: tmux

发表于 : 2010-07-18 19:11
BigSnake.NET
* A powerful, consistent, well-documented and easily scriptable command interface.
* A window may be split horizontally and vertically into panes.
* Panes can be freely moved and resized, or arranged into one of four preset layouts.
* Support for UTF-8 and 256-colour terminals.
* Copy and paste with multiple buffers.
* Interactive menus to select windows, sessions or clients.
* Change the current window by searching for text in the target.
* Terminal locking, manually or after a timeout.
* A clean, easily extended, BSD-licensed codebase, under active development.
貌似跟 screen 不同就这些

Re: tmux

发表于 : 2010-07-18 19:13
BigSnake.NET
tmux offers several advantages over screen:

- a clearly-defined client-server model: windows are independent entities which
may be attached simultaneously to multiple sessions and viewed from multiple
clients (terminals), as well as moved freely between sessions within the same
tmux server;
- a consistent, well-documented command interface, with the same syntax
whether used interactively, as a key binding, or from the shell;
- easily scriptable from the shell;
- multiple paste buffers;
- choice of vi or emacs key layouts;
- an option to limit the window size;
- a more usable status line syntax, with the ability to display the first line
of output of a specific command;
- a cleaner, modern, easily extended, BSD-licensed codebase.

Re: tmux

发表于 : 2010-07-18 20:44
adagio
囧,我运行tmux,它显示 Do you want to launch byobu in a nested session? [y/N]:
输入N直接退出,输入y就给我启动一个byobu,感觉就是byobu啊,有啥搞头?

Re: tmux

发表于 : 2010-07-18 21:07
BigSnake.NET
tmux 依赖 byobu ?

Re: tmux

发表于 : 2010-07-18 21:33
adagio
我明白了,我的byobu设为登录就启动,所以它好像认识
取消byobu登录启动就行了

不过感觉这东西按键太麻烦,不如byobu方便

Re: tmux

发表于 : 2010-07-18 22:14
BigSnake.NET
可以设啊

PS: byobu 的状态栏很恶心

Re: tmux

发表于 : 2010-07-19 16:38
millenniumdark
eexpress 写了:如果不如dtach简单。就没必要转了。估计按键难得熟悉。
默認的C-a改C-b 其他和screen 類似,再說,可以自設的

dtach 功能不一樣

Re: tmux

发表于 : 2010-07-20 10:28
rediscover
C/S 模式的,重量级玩意儿,不用。

Re: tmux

发表于 : 2010-07-23 14:18
BigSnake.NET

代码: 全选

#/bin/bash

S=`tmux ls`
U=`grep -v attached <<<"$S" | head -1 | cut -d\: -f1`
if [ -n "$U" ]
then
    tmux attach -t "$U"
else
    A=`grep attached <<<"$S" | head -1 | cut -d\: -f1`
    if [ -n "$A" ]
    then
        tmux new -t "$A"
    else
        tmux
    fi
fi

if [ "$?" -ne 0 ]
then
# fall back ..
    echo Oops ...
    bash
fi

代码: 全选

# $Id: screen-keys.conf,v 1.6 2010/02/02 21:34:16 nicm Exp $
#
# By Nicholas Marriott. Public domain.
#
# This configuration file binds many of the common GNU screen key bindings to
# appropriate tmux key bindings. Note that for some key bindings there is no
# tmux analogue and also that this set omits binding some commands available in
# tmux but not in screen.
#
# Note this is only a selection of key bindings and they are in addition to the
# normal tmux key bindings. This is intended as an example not as to be used
# as-is.

# Set the prefix to ^A.
unbind C-b
set -g prefix ^A
bind a send-prefix

# Bind appropriate commands similar to screen.
# lockscreen ^X x 
unbind ^X
bind ^X lock-server
unbind x
bind x lock-server

# screen ^C c 
unbind ^C
bind ^C new-window
bind c
bind c new-window

# detach ^D d
unbind ^D
bind ^D detach

# displays * 
unbind *
bind * list-clients

# next ^@ ^N sp n 
unbind ^@
bind ^@ next-window
unbind ^N
bind ^N next-window
unbind " "
bind " " next-window
unbind n
bind n next-window

# title A
unbind A
bind A command-prompt "rename-window %%"

# other ^A
unbind ^A
bind ^A last-window

# prev ^H ^P p ^? 
unbind ^H
bind ^H previous-window
unbind ^P
bind ^P previous-window
unbind p
bind p previous-window
unbind BSpace
bind BSpace previous-window

# windows ^W w 
unbind ^W
bind ^W list-windows
unbind w
bind w list-windows

# quit \ 
unbind \
bind \ confirm-before "kill-server"

# kill K k 
unbind K
bind K confirm-before "kill-window"
unbind k
bind k confirm-before "kill-window"

# redisplay ^L l 
unbind ^L
bind ^L refresh-client
unbind l
bind l refresh-client

# split -v |
unbind |
bind | split-window

# :kB: focus up
unbind Tab
bind Tab down-pane
unbind BTab
bind BTab up-pane

# " windowlist -b
unbind '"'
bind '"' choose-window

########################################

set -g history-limit 8000
set -g mouse-select-pane on
set -g set-titles on
set -g set-titles-string "[###S.#I #W] #T"
set -g status-left ""
set -g visual-bell on
set -g status-right "%H:%M %d-%b-%y"
setw -g window-status-current-format "#[bold,fg=black,bg=yellow][#I:#W#F]#[default]"

setw -g automatic-rename on
setw -g aggressive-resize on
setw -g mode-keys vi
setw -g mode-mouse on
setw -g monitor-activity on
# setw -g xterm-keys on


bind-key b set-option status
bind-key m command-prompt "split-window 'exec man %%'"