tmux 본문

Programming

tmux

halatha 2013. 3. 21. 11:05

http://blog.outsider.ne.kr/699

http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/

http://blog.hawkhost.com/2010/07/02/tmux-–-the-terminal-multiplexer-part-2/

http://webdizz.name/blog/2012/05/24/tmux-cheat-sheet/


tmux attach || tmux new — attaches to existing server process or creates new if it does not exist.


When you are in tmux terminal window you can use next commands to manage your session:


Ctrl+b d — to exit

Ctrl+b c — to create new window

Ctrl+b 0…9 — to switch to window number

Ctrl+b p — to switch to previous window

Ctrl+b n — to switch to next window

Ctrl+b l — to switch to previous active window (from which you switched to current)

Ctrl+b & — to close window (you can also type exit)


In one window you can have several panes:

Ctrl+b % — to split current window to 2 panes vertically

Ctrl+b “ — to split current window to 2 panes horizontally

Ctrl+b q — to see pane number

Ctrl+b →←↑↓ — to switch between panels

Ctrl+b o — next pane

Ctrl+b { or } — left(right) pane

Ctrl+b <alt> →←↑↓ — to adjust pane size

Ctrl+b <space> — switch pane layout between vertical and horizontal

Ctrl+b x — to close panel (or you can do this by typing exit).


Ctrl+b , change window name


Status bar configuration (~/.tmux.conf)

# Set status bar color

set -g status-bg black

set -g status-fg white

set -g status-left '#[fg=green]#H'


# Highlight active window

set-window-option -g window-status-current-bg red


# Show the number of users and the status of machine

set -g status-right ‘#[fg=yellow]#(uptime | cut -d “,” -f 2-)’


http://readystate4.com/2011/01/02/sharing-remote-terminal-session-between-two-users-with-tmux/

Allow another user access to your tmux session:

# specify the name of your tmux socket with -S when creating it

tmux -S /tmp/pair

# chmod to allow other users to access it

chmod 777 /tmp/pair

 

# now the other user can connect with

tmux -S /tmp/pair attach

Sudo your way into another users tmux session

# Have the user create a tmux session

# ls -al /tmp to see which tmux session is owned by the user you want to share sessions with then

# in the following example tmux-502 is the tmux socket folder of the example user 

sudo tmux -S tmux-502/delfault attach


su your way into the session

su username # need user's password or sudo

tmux attach

Comments