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 we have a named tmux session, we can attach to it like this:

 
$ ​tmux attach -t [session_name]

We use this target switch to direct the command to the appropriate tmux session. So, if we create a new tmux session called “development,” like this:

 
$ ​tmux new-session -s development

and we then detach from the session with Prefix d, then we could split that window horizontally by issuing ...

Get tmux 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.