Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up tmux so that it starts up with specified windows opened?

How to set up tmux so that it starts up with specified windows opened?

like image 882
satoru Avatar asked Apr 10 '11 01:04

satoru


People also ask

How do I autostart tmux?

To configure your terminal to automatically start tmux as default, add the following lines to your ~/. bash_profile shell startup file, just above your aliases section. Save the file and close it. Then close and reopen the terminal to start using tmux by default, every time you open a terminal window.

How do I switch windows in tmux?

Ctrl+b, let go of Ctrl, Letf / Right / Up / Down will switch active panes.

How do I go to a specific tmux session?

Using the Prefixes to Control Tmux By default, the prefix is CTRL+B. That is, we have to press the keys CTRL+B and then the command. For example, to create a new session, the command would be C. So, to create a new session we need to press CTRL+B and next C – CTRL+B, C.

How do you split windows in tmux?

ctrl + b + " to make a Horizontal split. ctrl + b + left arrow to move to the left pane. ctrl + b + " to make a Horizontal split.


1 Answers

You can write a small shell script that launches tmux with the required programs. I have the following in a shell script that I call dev-tmux. A dev environment:

#!/bin/sh tmux new-session -d 'vim' tmux split-window -v 'ipython' tmux split-window -h tmux new-window 'mutt' tmux -2 attach-session -d 

So everytime I want to launch my favorite dev environment I can just do

$ dev-tmux 
like image 103
Amjith Avatar answered Sep 19 '22 17:09

Amjith