Creating a Custom Setup with tmux Commands

We’ve already explored how we use the tmux command to create new tmux sessions, but the tmux command takes many other options. We can take an existing session and split its windows into panes, change layouts, or even start up applications within the session.

The key to this is the -t switch, or the “target.” When you have a named tmux session, you can attach to it like this:

 $ ​​tmux​​ ​​attach​​ ​​-t​​ ​​[session_name]

You can use this target switch to direct a tmux command to the appropriate tmux session. Create a new tmux session called “development,” like this:

 $ ​​tmux​​ ​​new-session​​ ​​-s​​ ​​development

Then detach from the session with Prefix d. Even though you’re no longer connected, ...

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.