run same command on multiple tmux panes

If you want to run same command on multiple servers, you can use tmux synchronize-panes feature. This will be useful when you need to setup multiple servers, say install nginx/php/mysql on multiple servers.

You can create multiple panes in tmux. SSH into each of the servers from these panes. Now run

CTRL + B :

Now type

setw synchronize-panes on

Whatever command you run on one of the pane will be executed on all panes. Be careful when you run server specific commands.

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *