Working with Windows

It’s possible, and very common, to run multiple, simultaneous commands within a tmux session. We can keep these organized with windows, which are similar to tabs in modern graphical terminal emulators or web browsers.

When we create a new tmux session, the environment sets up an initial window for us. We can create as many as we’d like, and they will persist when we detach and reattach.

Let’s create a new session that has two windows. The first window will have our normal prompt, and the second window will run the top command. Create a named session called “windows,” like this:

 $ ​​tmux​​ ​​new​​ ​​-s​​ ​​windows​​ ​​-n​​ ​​shell

By using the -n flag, we tell tmux to name the first window so we can identify it easily. ...

Get tmux 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.