1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Tmux notes

Last updated at Posted at 2013-11-24

Installation

Usally brew install tmux should work but not for me.

Installing libevent

Read this blog for more details
I tried to install tmux but I had error messages for iibevent which I installed through homebrew. So I first downloaded libevent.

$ cd Downloads\libevent-2.0.21-stable
$ ./configure && make
$ sudo make install

Installing tmux

Read this for more details

Then I downloaded tmux.

$ cd ..
$ cd tmux-1.8
$ ./configure && make
$ sudo make install

How to use it

Basic Usage

# start tmux
$ tmux
# or give the session a name, with -s <session_name>
$ tmux new -s rubyvim

Controlling Panes

# Split into two panes.
Ctrl-b %

# Split the pane horizontally
Ctrl-b "

# Switch to the next pane
Ctrl-b o

# To cycle through the panes, use up, down, left or right key
Ctrl-b Up

# Cycle through layouts
Ctrl-b space

# Kill a pane
exit
# or
Ctrl-b x

Windows

# To create a new window:
Ctrl-b c

# To move to the next window in the index:
Ctrl-b n

# To move backwards in the index:
Ctrl-b p

# To move to nth window, n = 1, 2, 3 etc
Ctrl-b n

# name widnow
Ctrl-b ,

# Find a window
Ctrl-b f
# and type a name

# Kill window
Ctrl-b &

# split windows with commands
$ tmux split-window

Session

# To go back to the normal terminal screen, you need to detach it from a session. 
Ctrl-b d

# To go back to the session you need to re-attach to a session
tmux attach -t [session name]

# View active sessions:
tmux list-sessions
# or shorthand
$ tmux ls

# A list of all command keys is accessible with:
Ctrl-b ?

# kill a session
$ tmux ls
0: 1 windows (created Sat Aug 17 00:03:56 2013) [80x23]
2: 1 windows (created Sat Aug 24 16:47:58 2013) [120x34]

$ tmux kill-session -t 2

$ tmux ls
0: 1 windows (created Sat Aug 17 00:03:56 2013) [80x23]

Command mode


# enter command mode
Ctrl-b :

# then create a new window
new-window -n console

# create a new window with starting a top program
new-window -n processes "top"

# quit the program
q

tmux.sh

tmux.sh
# !/bin/sh
tmux new-session -d -s sample_app

tmux new-window -t sample_app:2 -n 'server' 'bundle exec rails server'

tmux new-window -t sample_app:3 -n 'vim' 'vi'

tmux attach -t sample_app

Resources

Manual

tmux book

Tmux

[tmux shortcuts & cheatsheet]
(https://gist.github.com/MohamedAlaa/2961058)

A tmux Crash Course

LA Ruby Conference 2013

Chris Humt's tmux configuration

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?