Skip to content

Instantly share code, notes, and snippets.

@bobbzorzen
Last active December 2, 2022 19:18
Show Gist options
  • Save bobbzorzen/ab7e5492ddbdcaa6298a7cb0db776886 to your computer and use it in GitHub Desktop.
Save bobbzorzen/ab7e5492ddbdcaa6298a7cb0db776886 to your computer and use it in GitHub Desktop.
Basic script for starting a tmux session with specific windows and execute code in them
#!/bin/sh
tmux new-session -n "Name of window 1" -s "dev" -c "/home/<User>/workspace" -d '<command to run e.g. nano file.txt>'
tmux new-window -n "Name of Window 2" -c "/home/<User>/workspace" '<command to run e.g. nano file.txt>'
tmux next-window # Selects the next window, since we're currently selecting the last window, the next window is the first window
tmux -2 a # now we attach to the newly created session using 256 color mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment