I want to setup my terminal such that whenever I start it, it starts tmux in split window.

I know I want to add this into my .tmux.config: split-window -v -l 15

Now, I also want to start tmux from my .bash_profile, and I am not sure how.

I've read that it's recommended to use tmux new-session -A -s default that will attach or create to a new session.

If I do that then the .tmux.conf fails with 'no current session'. it want's me to start a new session in the tmux conf.

If I add new-session -A -s default to the conf, right before the split command, and then start tmux with tmux attach or rmux attach -t default or tmux new-session -A -s default then it loads, but with some error that it can't find some random .sesssion file, and the split is not exactly how I want it (actually not sure what happens in this case, it says 'restored session').

how exactly should I start tmux in this case?

  • i wouldn't include it in the .bash* files. i'd put an alias in .bash_aliases or .bashrc and execute it manually just after login. (alias tmxa=' tmux new-session -A -s default' or whatever.) this will avoid problems with trying to attach to a session inside your session.
    – quixotic
    Apr 3, 2017 at 20:35
  • I still prefer to have it automatically loaded.. What's the difference b\w running it manually and including the command in .bash*?
    – itaysk
    Apr 4, 2017 at 11:09

1 Answer 1


From some convenient bash environment, either the command line, or ~/.bashrc or bash function or whatever, try the following one-liner:

tmux new-session -A -s default \; split-window -v -l 15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .