Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tmux: How to automatically open sessions, windows, and panes

Tags:

tmux

I'm new to tmux and would like to configure it such that when I run tmux, my customized windows/panes are immediately accessible.

For example, here's a basic ~/.tmux.conf:

new -s main -n workspace
neww

When I run tmux, I get dumped into a plain old session. When I do a list-sessions, I can see the workspace session specified in the conf file, but in order to use it, I have to switch to it.

How can I just go ahead and make the "workspace" session the session I'm dumped into when I open tmux so that I don't have to switch to it every time?

like image 563
doremi Avatar asked Oct 24 '13 19:10

doremi


People also ask

How do I open multiple sessions in tmux?

To create multiple windows, you need at least one tmux session running. You can simply type CTRL + b, let go of both keys and type 'c'. This will open up a new terminal. At the bottom, you can see that there are now multiple windows (0, 1, 2) in the session.

How do you open new panes in tmux?

For example, to create a new window the hard way, you can press Ctrl+B followed by : to enter the tmux command line. Type new-window and press Enter to create a new window. This does exactly the same thing as pressing Ctrl+B then C.

How do I view all tmux sessions?

To enter command mode, type prefix>: followed by list-sessions or ls to view a list of currently active Tmux sessions. By default, list-sessions are bound to the prefix> s key combination. With j and k, you may explore the session list and activate one by hitting enter.


1 Answers

Not sure I understood the question, but I use tmuxinator to quickly launch sessions pre-populated with windows, panes and processes.

like image 63
Thomas Ferris Nicolaisen Avatar answered Sep 22 '22 19:09

Thomas Ferris Nicolaisen