start tmux with one session with multiple windows

34 views
Skip to first unread message

Brian J. Murrell

unread,
Dec 28, 2021, 11:47:59 AM12/28/21
to tmux-...@googlegroups.com
I am trying to migrate from screen to tmux. Right now I have a
.screenrc:

screen top
screen tail -f /var/log/messages
screen

that opens a number of windows in a screen session which I just run:

# screen -x

to start. With the above .screenrc I have 3 windows with the third
window being the one I open to with a shell prompt.

In trying to do the same with tmux, the closest I could come up with is
this in a .tmux.conf:

new-session -d -s main top # screen top
new-window 'tail -f /var/log/messages'
new-window

But that does not leave me on the third window of the [new] session.
And it also creates 2 sessions when I only want one and leaves me on
the only window of session 1 and not the third window of session
"main".

What I want is to just run "tmux" (i.e. at the command prompt, with no
other arguments) to start a single session with multiple open windows
in it and be active in the third window of that single session.

Suggestions?
signature.asc

Nicholas Marriott

unread,
Dec 28, 2021, 11:49:26 AM12/28/21
to Brian J. Murrell, tmux-users
If you create sessions in the config file you probably want to start tmux with "tmux attach" or "tmux start" since the default command without arguments is "tmux new" which will leave you with an extra session.



--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/e521bc627bd3d1f64e449731ff0675cfc8f2e393.camel%40interlinx.bc.ca.

Brian J. Murrell

unread,
Dec 28, 2021, 12:00:25 PM12/28/21
to tmux-users
On Tue, 2021-12-28 at 16:49 +0000, Nicholas Marriott wrote:
> If you create sessions in the config file you probably want to start
> tmux
> with "tmux attach"

That works, and is an acceptable work-around. Much like "screen -x".


Much thanks!

Cheers,
b.

signature.asc
Reply all
Reply to author
Forward
0 new messages