본문 바로가기

TECH DOC

TMUX v1.0

TMUX

 

Date

Ver

Etc.

12.07.04

1.0

 

 

 

 

 

 

 

 

 

1.    TMUX

tmux terminal multiplexer 의 약어로, 하나의 Screen 에서 다수의 터미널을 제어를 가능케 한다.

 

tmux OpenBSD base system 프로젝트의 파트이다.

2.    Installation TMUX on Linux

다음의 위치에서 tmux 를 다운로드 받는다.

http://sourceforge.net/projects/tmux/files/tmux/tmux-1.6/tmux-1.6.tar.gz/download

 

다운로드 받은 파일을 설치 할 위치에서 압축해제한다.

test2[ogg2]@/u01>ls

app       import.log  mysql  ogg.dmp          V17530-01_1of2.zip

database  lost+found  ogg    tmux-1.6.tar.gz  V17530-01_2of2.zip

test2[ogg2]@/u01>tar xvf tmux-1.6.tar.gz

 

압축을 해제하면 tmux-1.6 이란 디렉토리가 생성된다.

해당 디렉토리로 이동하여 configure 를 실시한다.

 

test2[ogg2]@/u01/tmux-1.6>./configure --prefix=/u01/tmux

 

위에서 –prefix 의미는 설치 디렉토리를 지정한다.

 

checking for library containing event_init... no

configure: error: "libevent not found"

 

libevent not found 에러가 발생하였다.

yum 을 이용해 설치한다.

 

[root@test2 ~]# yum install libevent

 

[root@test2 ~]# yum install libevent-devel

 

다시 configure 를 실시했을 때 다음의 에러가 발생하는 경우 추가적인 패키지 설치가 필요하다.

configure: error: "curses not found"

 

[root@test2 ~]# yum install ncurses-devel

 

이후 정상적으로 configure 가 완료되면 다음과 같은 메시지를 확인할 수 있다.

test2[ogg2]@/u01/tmux-1.6>./configure --prefix=/u01/tmux

checking for a BSD-compatible install... /usr/bin/install –c

configure: creating ./config.status

config.status: creating Makefile

config.status: executing depfiles commands

 

 

configure 가 완료되면 Install 을 한다.

test2[ogg2]@/u01/tmux-1.6>make install

 

Install 이 완료되면 prefix 로 지정했던 위치에 다음과 같은 결과물을 확인할 수 있다.

test2[ogg2]@/u01>tree /u01/tmux

/u01/tmux

|-- bin

|   `-- tmux

`-- share

    `-- man

        `-- man1

            `-- tmux.1

 

4 directories, 2 files

 

실행은 /u01/tmux/bin/tmux 로 실행한다.

 

3.    Configuration for TMUX

아래의 내용은 ~/.tmux.conf 의 내용이다.

# CTRL - A

set-option -g prefix C-a à 명령 을 받기 위한 입력을 Ctrl+a 사용

bind-key C-a last-window à 바로 전의 작업 윈도우로 이동

 

# Synchronize panes

bind-key * set-window-option synchronize-pane à Window 에 오픈한 panes 를 동시컨트롤

 

# Reload

bind-key r source-file ~/.tmux.conf à TMUX configuration reload

 

set-option -g history-limit 10240

 

# Enable mouse control

set-option -g mouse-resize-pane on à 마우스 드래그로 pane 사이즈를 조절

set-option -g mouse-select-pane on à 마우스 클릭으로 pane 을 선택

set-option -g mouse-select-window on à 마우스 클릭으로 window 를 선택

set-window-option -g mode-mouse on à 마우스 모드의 사용

set-window-option -g mode-keys vi

 

set-option -g status-justify left

set-option -g status-keys vi

set-option -g status-left '#[bg=blue] #[bg=black]#[fg=blue,bold] #h '

set-option -g status-bg black

set-option -g status-right '#[bg=black]#[fg=blue,bold] #(date "+%a %b %d %H:%M") #[bg=blue] '

set-option -g status-interval 60

 

set-window-option -g window-status-format '#[bg=green] #I #[bg=yellow]#[fg=black] #W '

set-window-option -g window-status-current-format '#[bg=red]#[fg=white,bold] #I #[bg=magenta,bold]#[fg=white,bold] #W '

set-window-option -g utf8 on

 

4.    Command

아래의 명령어를 입력하기 위해서는 Ctrl+b 를 먼저 입력한다.

(3번에서는 prefix 키를 Ctrl+a 로 변경하였다. 밑에서 표시한 대문자 ‘C’ ctrl 을 의미하며 ‘M’ Alt 를 의미한다.)

 

C-o // 현재의 윈도우의 pane 의 위치를 회전시킨다. (디스플레이 순서를 변경)

C-z // tmux client 를 일시중지한다.

! // 윈도우 안의 패널을 새로운 윈도우로 분리한다.

“ // 현재 패널을 상하로 나눈다.

# // 복사했던 문자열들을 리스팅한다.

$ // 현재 세션의 이름을 편집한다.

% // 현재 패널을 좌우로 나눈다.

& // 현재 윈도우를 종료한다.

, // 현재 윈도우의 이름을 편집한다.

. // 현재 윈도우를 다른 번호의 윈도우로 이동

0 to 9 // 윈도우를 선택한다.

: // tmux command prompt 로 이동한다.

= // 버퍼로부터 붙여넣을 리스트를 선택한다.

? // 모든 바인딩을 표시한다.

D // 연결을 분리할 클라이언트를 선택한다.

[ // Copy mode 로 들어가거나 history 를 본다.

] //  가장 최근에 복사되었던 버퍼나 텍스트를 붙여넣는다.

c // 새로운 윈도우를 생성한다.

d // 현재 클라이언트를 분리한다.

f // 열린 윈도우에서 텍스트를 검색한다.

i // 현재 윈도우에 대한 정보를 표시한다.

n // 다음 윈도우로 변경한다.

t // 시계를 표시한다.

x // 현재 pane 을 종료한다.

{ or } // 현재의 pane { : 앞으로 가져오거나 } : 뒤로 가져간다.

Page Up // copy mode 로 진입하며 한 페이지씩 열람할 수 있다.

Up, Down, Left, Right // pane 을 해당하는 방향으로 변경할 수 있다.

M-1 to M-5 // lay-out 을 변경한다.

M-Up, M-Down, M-Left, M-Right // 현재 pane 의 사이즈를 조정한다.