tmuxtutor / windows

A brief tmux tutorial inspired by vimtutor

Download as .zip Download as .tar.gz View on GitHub

tmuxtutor.windows

== Working with windows

You are in window 0 right now. To go to this window from anywhere, type

  PREFIX + 0

Let's open a a new window with

  PREFIX + c

You will be in that new window number 1 now and see an additional entry in the status bar at the bottom. Go back with PREFIX + 0.

Navigating windows

You can interactively choose any window by typing

  PREFIX + w

This will give you a list of windows in your session. You should see two entries at this point.

Windows with numbers 0-9 are a bit easier to access. Just type

  PREFIX + n

where n is the window number.

Another possibility is to be prompted for the number:

  PREFIX + ' (single quote)

lets you type in a number, so this is especially useful for windows with an index greater than 9.

You can also navigate to the last recently used window with

  PREFIX + l

Play around by opening/closing windows and navigating between them.

Go to the next

  PREFIX + n

or previous window

  PREFIX + p

Window positions

If you want to move the window to another position, type:

  PREFIX + . (dot)

You can now enter the new position. Note that the new window index must be free (not used by a window).

You can swap two windows with the command

  PREFIX + :swap-window -t -1
  PREFIX + :swap-window -t +1

Window titles

You can give a title to a window with:

  PREFIX + , (comma)

You can see the window titles in the status bar.

If you don't give a title, it will be automatically set to the name of the process, usually your shell.

Open a new window with

  PREFIX + c

The title will be your shell (e.g. bash, zsh, ...). Now type:

  sleep 5

You'll see the title changes to sleep, and when the process finishes, it will be renamed back. This can be very handy if you run a long process in another window - you'll be able to see when it finishes. You can also configure to be notified about that in the status line. Type:

  PREFIX + :set -g monitor-activity on

To try this out, go to window number 1 where you ran the sleep, type sleep 10, go back to window number 0 and wait. When the sleep finishes, the window 1 in the status bar should be highlighted.

  PREFIX + 1 (window 1)
  % sleep 10
  PREFIX + 0
  # wait

Closing windows

Typing exit or CTRL-d will close a shell and the window, but there's also a command:

  PREFIX + &

It asks for confirmation.