Skip to content

Instantly share code, notes, and snippets.

@milisarge
Last active December 29, 2021 07:02
Show Gist options
  • Select an option

  • Save milisarge/ede7cef488a3b505e14e95dd30c4ecd2 to your computer and use it in GitHub Desktop.

Select an option

Save milisarge/ede7cef488a3b505e14e95dd30c4ecd2 to your computer and use it in GitHub Desktop.
Tmux shells from script
#!/bin/sh
tmux new-session -d -s work1 'cd a/b/c'; # start new detached tmux session, run htop
tmux split-window; # split the detached tmux session
tmux send 'cd /d/e/f' ENTER; # send 2nd command 'htop -t' to 2nd pane. I believe there's a `--target` option to target specific pane.
#tmux a;
tmux new-session -d -s work2 'htop';
# default vertical / -h horizontal
tmux split-window -h;
tmux send 'a/b/c/myscript.sh' ENTER;
tmux a;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment