tmux - terminal multiplexerjava.ociweb.com/mark/other-presentations/tmux.pdf · tmux overview...

Post on 09-Mar-2018

225 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

tmux - Terminal Multiplexer

Mark Volkmannmark@ociweb.com

tmux

Overview

Dramatically expands what can be donewith terminal windowsAlternative to older program named “screen”Often used for interactive server sessions

that can survive network disconnections

2

tmux

Book

tmux: Productive Mouse-Free DevelopmentBrian P. Hogan

Pragmatic Programmers

3

tmux

For You?

Do you work in a Unixey environment?Do you frequently use terminal windows?Do you value using keyboard shortcuts?

4

tmux

tmux Commands

Large number of themMany ways to execute

command-line

shell script

command mode in tmux client

keyboard shortcut in tmux client

tmux configuration file

5

tmux

Key Bindings

Prefix keyC-b by default; many change to C-a

Meta keyabbreviated as M; cmd-option on Mac

Commandslist-keys or prefix ?

bind-key [-r] {key} {command}

-r allows repeated used without prefix

unbind-key {key}

6

tmux

Terminology

serverclientsessionwindowpanestatus bar

7

tmux

Sample Session

Demo time!

8

tmux

Session Actions

newdetachattachlistrenameswitch - one being displayedkill

9

tmux

Window Actions

newrenameswitch - one being viewedlistmove - to a different sessionkill

10

tmux

Pane Actions

new - via splitswitch - one that is activechange layoutresizerotate - to change position of allswap - to change position of twomove - to different windowexecute command - from a script into a specific panekill

11

tmux

Predefined Pane Layouts ...

even-horizontal

12

even-vertical

tmux

... Predefined Pane Layouts

main-horizontalmain-verticaltiled

13

tmux

Buffers

Each pane has a buffer that storescommands entered and their output

has a limited size that defaults to 2000 lines

Enter “copy mode” toscroll through and copy linesEach copy adds a “paste buffer” to a stack

has a limited size that defaults to 20

14

tmux

Copy Mode Actions

enter copy modeexit copy modemove cursorcopy selected textcopy all visible textlist paste buffersview paste buffer contents

save paste buffercontent to a filepaste text froma paste bufferchange paste bufferstack sizedelete one paste bufferdelete all paste buffers

15

tmux

Configuration Options

Three kindsserver

session

window

Option scopeglobal

specific session

specific window

Actionsset option

show option

16

tmux

Configuration Files

Looks for ~/.tmux.conf firstThen looks for /etc/tmux.confLet’s examine mine!

17

tmux

Scripting

Consider creating one setup script for each projectCreates a new project session if it doesn’t exist

creates windows

splits them into panes

starts commands in some windowsex. editor, file watching apps, ssh, ...

Otherwise, attaches to existing sessionLet’s examine one of mine!

18

tmux

Collaboration

ssh to a remote serverStart a tmux session thereAsk others to

ssh to same remote server

attach to same tmux session

Collaborate!

19

tmux

Multiple Monitors

Run client in first monitor attached to main sessionRun client in other monitors attached to a new session that is “grouped” with main sessionAllows each client to viewa different window in main sessionSet window option “aggressive-resize” to “on”

allows each client window to be a different size

20

tmux

Mac Specific Advice

Use iTerm2Change some System PreferencesChange some iTerm2 PreferencesFor details, see my OCI SETT article

http://sett.ociweb.com/sett/settJan2013.html

21

tmux

Thanks For Listening!

mark@ociweb.com

22

top related